I am studying the VC API and writing software to work with him. All parsing json-on with VK API I put on SuperObject. And he did an excellent job with his task, but let him down on a stress test. I fed him this json:
{"response": {"count": 204, "items": [{"id": 154770, "body": "", "user_id": 1, "from_id": 1, "date": 1492002564, " read_state ": 1," out ": 0," random_id ": 965793707," fwd_messages ": [{" user_id ": 1," date ": 1492002563," body ":" "," fwd_messages ": [{" user_id ": 1," date ": 1492002561," body ":" cake "," fwd_messages ": [{" user_id ": 1," date ": 1492002534," body ":" lol "," fwd_messages ": [{ "user_id": 1, "date": 1492002530, "body": "", "fwd_messages": [{"user_id": 1, "date": 1492002528, "body": "", "fwd_messages": [{ "user_id": 1, "date": 1492002512, "body": "", "fwd_messages": [{"user_id": 1, "date": 1492002510, "body": "", "fwd_messages": [{ "user_id": 1, "date": 1492002508, "body": "", "fwd_messages": [{"user_id": 1, "date": 1492002506, "body": "", "fwd_messages": [{ "user_id": 1, "date": 1492002504, "body": "", "fwd_messages": [{"user_id": 1, "date": 1492002499, "body": "", "fwd_messages": [{ "user_id": 1, "date": 1492002497, "body": "", "fwd_messages": [{"user_id": 1, "date": 1492002494, "body": "", "fwd_messages": [{ "user_id": 1, "date": 1492002492, "body": "", "fwd_messages": [{"user_id": 1, "date": 1492002490 , "body": "", "fwd_messages": [{"user_id": 1, "date": 1492002488, "body": "", "fwd_messages": [{"user_id": 1, "date": 1492002486 , "body": "", "fwd_messages": [{"user_id": 1, "date": 1491925392, "body": "", "fwd_messages": [{"user_id": 1, "date": 1490901947 , "body": "test message"}]]]}]}]}]}]}]}]}]}]}]}]}]}]}]}]]]}]}]}], "in_read": 155942, "out_read": 155942}}
As a result, when you try to parse it, it just falls with an error. Of course, I could catch errors and just go ahead in case of an error, but unfortunately, this does not suit me. By this, I first began to look towards finding new libraries. And I stumbled upon the uLkJSON library. And everything is fine, it fully complies with the requirements, but here is bad luck .. I need to return not just some parameters from jsona, but to transfer a whole json object from the array of the form: [{...},{...},{...}] . It is with curly brackets and everything as needed. and all this is converted into a string, so that its function is further parsed. But as I did not fight, I just can not do it. I tried to pull out like this:
TlkJSON.ParseText(response_loadmessage).Field['response'].field['items'].Child[0].Value; But in the end, I fall with an error. I can not understand what the problem is and nowhere can I find a solution. I really hope for your help, and in case of anything, offers me other libraries to work with json.
items- an array of one object, and not an array of objects. Do you need to get it? With the standard parser that is built into Delphi, this object gets pretty easy: pastebin.com/ENmWSuGL - zed