Re: [Cppcms-users] json
Brought to you by:
artyom-beilis
|
From: redred77 <red...@gm...> - 2016-01-22 22:14:38
|
How about sending stringify data per parameter if it is an array type? So
plain key=text will be sent normally but array= will have return data of
JSON.stringify.
This will make you to deal with convenient request().post() as before.
Thanks.
2016. 1. 23. 오전 4:50에 "Василий Теркин" <par...@gm...>님이 작성:
> Hello everybody.
> Let's imagine jquery requests:
> 1)
> $.ajax({
> method: "POST",
> url: "/test",
> contentType: "application/json",
> data: { "key": "test", "array": ["v1","v2","v3"] }
> })
>
> jquery sends data in post form fields something like:
> key=test&array[]=v1&array[]=v2&array[]=v3
> -> cppcms doesn't aggregate values into single json array via
> request().post("array")
> (neither "array", nor "array[]")
>
> 2)
> $.ajax({
> method: "POST",
> url: "/test",
> contentType: "application/json",
> data: JSON.stringify({ "key": "test", "array": ["v1","v2","v3"] })
> })
>
> now we get content in json string format, but
> a) request().post() doesn't work;
> b) request doesn't have stream interface to fill cppcms::json::value, so
> we have to deal with raw_post_data(), which is not recommended.
>
> Do we have a convenient way to deal with json request?
> Thanks.
>
>
> ------------------------------------------------------------------------------
> Site24x7 APM Insight: Get Deep Visibility into Application Performance
> APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
> Monitor end-to-end web transactions and take corrective actions now
> Troubleshoot faster and improve end-user experience. Signup Now!
> http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140
> _______________________________________________
> Cppcms-users mailing list
> Cpp...@li...
> https://lists.sourceforge.net/lists/listinfo/cppcms-users
>
>
|