-
-
Notifications
You must be signed in to change notification settings - Fork 6.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wishlist #65
Comments
Hi @jrandall, thanks for the input. I have an idea what you mean, and I have an idea how to realize it. Could you give me some references for PHP and jQuery so I can check? |
Without more information, I close this issue for now. |
@nlohmann it looks like you replied to me instead of @jwaterloo by mistake. @jwaterloo, perhaps you can provide the references for PHP and jQuery that Niels is looks for? |
Oops, my bad... |
Hi @jwaterloo, thanks for the input. I have an idea what you mean, and I have an idea how to realize it. Could you give me some references for PHP and jQuery so I can check? |
On 6/16/2015 4:43 PM, Niels wrote:
http://api.jquery.com/jQuery.param/ jQuery.param() |// >=1.4:| In our case see also http://api.jquery.com/jQuery.ajax/ which is used throughout By default, Ajax requests are sent using the GET HTTP method. If the The data option can contain either a query string of the form In case of PHP, it automatic. Whenever you request anything from the Any C++ library should definitely have the general use case for when ... More jQuery usage http://api.jquery.com/serialize/ web developers typically name there input fields "d[2][e]" so when the |
Thanks. I'll have a look and maybe come back if I have some questions. Until then, I would appreciate more concrete examples.
|
Hi @jwaterloo, could you be so kind and give me more concrete examples? |
On 6/17/2015 5:55 PM, Niels wrote:
I am not over set on the names // flatten // boost|std::any means boost::any or std::any depending on which // there should be a symmetric operation // symmetry guarantees std::map<wstring, wstring> values = ...; // what does parameters look like result of flatten(somename, "somename"); ... std::map<wstring, any|variant|primitive_json> values; ... // real world usage // HTTP GET write server servlet code to generate following HTML
// HTTP POST // NOTE: usecase, no complicated manual serialization or // Next request: SECURITY |
I think this change is too complicated and does not really cover JSON core functionality. |
A common use case in web development is the need for flatten and unflatten functions, that is the ability to flatten a json object into a map of javascript assignment strings and vice versa.
{
"member1" : true,
"member2" : "Hello World",
"member3" : [1, {"member4" : 4, "member5" : 6.5}, 3]
}
into
prefix "whatever"
key = whatever.member1
value = true
key = whatever.member2
value = "Hello World"
key = whatever.member3[0]
value = 1
key = whatever.member1[1].member4
value = 4
key = whatever.member1[1].member5
value = 6.5
key = whatever.member3[2]
value = 3
function sighatures would be something like
map<string, json_primitive_that_insn't_object_or_array> flatten(json_object_or_array, symbol_name);
json_object_or_array unflatten(map<string, json_primitive_that_insn't_object_or_array>, symbol_name);
The type of the map would be string to a json primitive that isn't an object or an array.
The use case is that the keys in the map could be used as form field names. PHP and jQuery both are already doing this natively. Wouldn't it be nice if C++ had equal or better footing for web development.
The text was updated successfully, but these errors were encountered: