[Cppcms-users] json
Brought to you by:
artyom-beilis
|
From: Василий Т. <par...@gm...> - 2016-01-22 19:49:26
|
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.
|