json_decode failing - php

I have the following JSON formatted string:
{
"hooks":[
{
"type":"subscribe",
"id":1331741592.6925,
"email":"JoeX#test-email.com",
"status":"Active",
"custom_fields":"{\"first_name\":\"Joe\",\"last_name\":\"X\"}",
"ip_created":"24.199.200.142",
"list_id":"33",
"list_type":"internal",
"list_name":"Administrator List 2",
"list_optin":false
},
{
"type":"subscribe",
"id":1331741592.7067,
"email":"JaneY#test-email.com",
"status":"Active",
"custom_fields":"{\"first_name\": \"Jane\",\"last_name\":\"Y\"}",
"ip_created":"24.199.200.142",
"list_id":"33",
"list_type":"internal",
"list_name":"Administrator List 2",
"list_optin":false
}
]
}
I want to use the PHP json_decode() function to put it in an associative array.
When I do run the script, debugging shows the value of the new array as null, so I presume the decode is failing. We aren't running PHP 5.3, so I can't use json_last_error(). Here is the code:
$hooks = (the JSON string from above);
$hooksArray = json_decode($hooks, true);
Any ideas why the $hooksArray is coming back null?

Is the JSON string inside your PHP source? Perhaps it's not interpreting the escaped backslashes correctly.
I tried the following experiment in Python for reference: Dumped the JSON data into a multi-line string via the REPL and decode it with json.loads(). It choked on the in-string quotes in the first instance of the custom_fields string. When I examined the multi-line string, all the escapes were gone, leaving me only with the quotes.
When I put the same JSON data in an external file and loaded it, it worked fine.
I put the JSON data in an external file and replaced all '\"' instances with '\\"' and then the first experiment started to work.
Maybe that will work for you too.

Related

Error converting Json string to array of objects PHP

I made a post in a form converting my javascript localstorage to a post request. From there I tried to decode my json string to make an object in PHP.
How my php code looks before I echo it
$cart_items = $_POST['cart_items'];
$cart_items = json_encode($cart_items);
$array_test = json_decode($cart_items);
print_r($array_test);
What it returns in browser
[{\"id\":83494890,\"title\":\"2020 Hino 358\",\"partType\":\"Bumpers\",\"price\":100,\"stockNumber\":12313131312,\"thumbImg\":\"/jOIY91KhEby8_f.jpg\",\"permalink\":\"/part-description/?part=83494890\",\"maxQuantity\":1,\"requestedQuantity\":\"3\"}
,{\"id\":83493833,\"title\":\"2009 Freightliner 5020080\",\"partType\":\"ABS Modulator Valves\",\"price\":150,\"stockNumber\":\"P-1211111111157\",\"thumbImg\":\"/OOjQbsi6p8kX_f.jpg\",\"permalink\":\"/part-description/?part=83493833\",\"maxQuantity\":1,\"requestedQuantity\":\"1\"}]
I know that typically when seeing json data there isn't forward slashes everywhere. I tried to json_decode into an array rather than an object, then make a foreach for each object inside. But I got this error returned "Invalid argument supplied for foreach()"
How do I make this json string convert to an array of objects? Thank you
The problem I was having was when I was getting the $_POST[] it was using PHP's "magic quotes" which was giving me improper format for my json. That being said, after disabling this, it removes the slashes.
It looks like $_POST['cart_items'] already contains JSON. So you just need to decode it, not encode it first.
$array_test = json_decode($_POST['cart_items'], true);
print_r($array_test);
But it's actually encoded twice, that's why it has escaped quotes, so you need to call json_decode() twice. But it's missing the double quotes around the whole thing, and the embedded newline is not valid.
The following works:
<?php
$cart_items = '"[{\"id\":83494890,\"title\":\"2020 Hino 358\",\"partType\":\"Bumpers\",\"price\":100,\"stockNumber\":12313131312,\"thumbImg\":\"/jOIY91KhEby8_f.jpg\",\"permalink\":\"/part-description/?part=83494890\",\"maxQuantity\":1,\"requestedQuantity\":\"3\"},{\"id\":83493833,\"title\":\"2009 Freightliner 5020080\",\"partType\":\"ABS Modulator Valves\",\"price\":150,\"stockNumber\":\"P-1211111111157\",\"thumbImg\":\"/OOjQbsi6p8kX_f.jpg\",\"permalink\":\"/part-description/?part=83493833\",\"maxQuantity\":1,\"requestedQuantity\":\"1\"}]"';
$array_test = json_decode(json_decode($cart_items));
print_r($array_test);
I suggest you find the code that's sending the cart_item POST parameter and fix it so it doesn't do all this extra encoding.

How to make a JSON String to JSON

"villageJson": "{\"newShopTraps\":[6,6,3,0,0,4,2,0,2],\"cooldowns\":[],\"last_league_shuffle\":1,\"decos\":[{\"data\":18000031,\"x\":2,\"y\":36},{\"data\":18000011,\"x\":4,\"y\":36},{\"data\":18000027,\"x\":6,\"y\":38},{\"data\":18000012,\"x\":6,\"y\":40},{\"data\":18000033,\"x\":6,\"y\":36}],\"edit_mode_shown\":true,\"buildings\":[{\"lvl\":7,\"data\":1000001,\"x\":20,\"y\":19},{\"lvl\":8,\"data\":1000004,\"x\":22,\"y\":33,\"res_timer\":0},{\"lvl\":5,\"data\":1000000,\"x\":9,\"y\":8},{\"lvl\":0,\"data\":1000015,\"x\":28,\"y\":5},{\"lvl\":3,\"data\":1000014,\"x\":20,\"y\":16},{\"lvl\":9,\"data\":1000008,\"x\":10,\"y\":23},{\"lvl\":0,\"data\":1000015,\"x\":34,\"y\":28},{\"lvl\":8,\"data\":1000002,\"x\":16,\"y\":33,\"res_timer\":120625},{\"lvl\":10,\"data\":1000003,\"x\":21,\"y\":12},{\"lvl\":10,\"data\":1000005,\"x\":13,\"y\":20},{\"lvl\":9,\"data\":1000006,\"x\":34,\"y\":15},{\"lvl\":9,\"data\":1000008,\"x\":10,\"y\":14},{\"lvl\":9,\"data\":1000009,\"x\":15,\"y\":9},{\"lvl\":6,\"data\":1000010,\"x\":25,\"y\":8},{\"lvl\":6,\"data\":1000010,\"x\":24,\"y\":8},{\"lvl\":6,\"data\":1000010,\"x\":23,\"y\":8},{\"lvl\":6,\"data\":1000010,\"x\":22,\"y\":8},{\"lvl\":6,\"data\":1000010,\"x\":21,\"y\":8},{\"lvl\":6,\"data\":1000010,\"x\":20,\"y\":8},{\"lvl\":6,\"data\":1000010,\"x\":19,\"y\":8},{\"lvl\":6,\"data\":1000010,\"x\":18,\"y\":8},{\"lvl\":6,\"data\":1000010,\"x\":17,\"y\":8},{\"lvl\":6,\"data\":1000010,\"x\":16,\"y\":8},{\"lvl\":6,\"data\":1000010,\"x\":15,\"y\":8},{\"lvl\":6,\"data\":1000010,\"x\":27,\"y\":32},{\"lvl\":6,\"data\":1000010,\"x\":26,\"y\":32},{\"lvl\":6,\"data\":1000010,\"x\":25,\"y\":32},{\"lvl\":6,\"data\":1000010,\"x\":24,\"y\":32},{\"lvl\":6,\"data\":1000010,\"x\":23,\"y\":32},{\"lvl\":6,\"data\":1000010,\"x\":22,\"y\":32},{\"lvl\":6,\"data\":1000010,\"x\":21,\"y\":32},{\"lvl\":6,\"data\":1000010,\"x\":20,\"y\":32},{\"lvl\":6,\"data\":1000010,\"x\":19,\"y\":32},{\"lvl\":6,\"data\":1000010,\"x\":18,\"y\":32},{\"lvl\":6,\"data\":1000010,\"x\":17,\"y\":32},{\"lvl\":6,\"data\":1000010,\"x\":16,\"y\":32},{\"lvl\":6,\"data\":1000010,\"x\":14,\"y\":32},{\"lvl\":6,\"data\":1000010,\"x\":15,\"y\":32},{\"lvl\":7,\"data\":1000010,\"x\":5,\"y\":25},{\"lvl\":7,\"data\":1000010,\"x\":5,\"y\":26},{\"lvl\":7,\"data\":1000010,\"x\":6,\"y\":26},{\"lvl\":7,\"data\":1000010,\"x\":7,\"y\":26},{\"lvl\":6,\"data\":1000010,\"x\":26,\"y\":8},{\"lvl\":6,\"data\":1000010,\"x\":33,\"y\":13},{\"lvl\":6,\"data\":1000010,\"x\":33,\"y\":14},{\"lvl\":6,\"data\":1000010,\"x\":33,\"y\":15},{\"lvl\":6,\"data\":1000010,\"x\":33,\"y\":16},{\"lvl\":6,\"data\":1000010,\"x\":33,\"y\":17},{\"lvl\":7,\"data\":1000010,\"x\":8,\"y\":26},{\"lvl\":7,\"data\":1000010,\"x\":9,\"y\":26},{\"lvl\":7,\"data\":1000010,\"x\":10,\"y\":26},{\"lvl\":7,\"data\":1000010,\"x\":11,\"y\":26},{\"lvl\":7,\"data\":1000010,\"x\":12,\"y\":26},{\"lvl\":7,\"data\":1000010,\"x\":13,\"y\":26},{\"lvl\":7,\"data\":1000010,\"x\":13,\"y\":27},{\"lvl\":6,\"data\":1000010,\"x\":33,\"y\":18},{\"lvl\":6,\"data\":1000010,\"x\":33,\"y\":19},{\"lvl\":6,\"data\":1000010,\"x\":33,\"y\":20},{\"lvl\":6,\"data\":1000010,\"x\":33,\"y\":21},{\"lvl\":6,\"data\":1000010,\"x\":33,\"y\":22},{\"lvl\":6,\"data\":1000010,\"x\":33,\"y\":23},{\"lvl\":6,\"data\":1000010,\"x\":33,\"y\":24},{\"lvl\":6,\"data\":1000010,\"x\":33,\"y\":25},{\"lvl\":5,\"data\":1000000,\"x\":29,\"y\":28},{\"lvl\":5,\"data\":1000013,\"x\":13,\"y\":23},{\"lvl\":5,\"data\":1000007,\"x\":29,\"y\":33},{\"lvl\":10,\"data\":1000005,\"x\":27,\"y\":16},{\"lvl\":10,\"data\":1000003,\"x\":27,\"y\":24},{\"lvl\":9,\"data\":1000009,\"x\":27,\"y\":13},{\"lvl\":6,\"data\":1000010,\"x\":33,\"y\":26},{\"lvl\":6,\"data\":1000010,\"x\":30,\"y\":27},{\"lvl\":7,\"data\":1000010,\"x\":13,\"y\":28},{\"lvl\":7,\"data\":1000010,\"x\":13,\"y\":29},{\"lvl\":7,\"data\":1000010,\"x\":13,\"y\":30},{\"lvl\":7,\"data\":1000010,\"x\":13,\"y\":31},{\"lvl\":6,\"data\":1000010,\"x\":31,\"y\":27},{\"lvl\":6,\"data\":1000010,\"x\":32,\"y\":27},{\"lvl\":6,\"data\":1000010,\"x\":33,\"y\":27},{\"lvl\":6,\"data\":1000010,\"x\":34,\"y\":27},{\"lvl\":6,\"data\":1000010,\"x\":35,\"y\":27},{\"lvl\":6,\"data\":1000010,\"x\":36,\"y\":27},{\"lvl\":6,\"data\":1000010,\"x\":37,\"y\":27},{\"lvl\":6,\"data\":1000010,\"x\":37,\"y\":26},{\"lvl\":6,\"data\":1000010,\"x\":37,\"y\":25},{\"lvl\":6,\"data\":1000010,\"x\":37,\"y\":24},{\"lvl\":6,\"data\":1000010,\"x\":37,\"y\":23},{\"lvl\":6,\"data\":1000010,\"x\":37,\"y\":22},{\"lvl\":6,\"data\":1000010,\"x\":37,\"y\":21},{\"lvl\":6,\"data\":1000010,\"x\":37,\"y\":20},{\"lvl\":6,\"data\":1000010,\"x\":37,\"y\":19},{\"lvl\":6,\"data\":1000010,\"x\":37,\"y\":18},{\"lvl\":7,\"data\":1000010,\"x\":13,\"y\":32},{\"lvl\":7,\"data\":1000010,\"x\":13,\"y\":33},{\"lvl\":7,\"data\":1000010,\"x\":13,\"y\":34},{\"lvl\":8,\"data\":1000002,\"x\":19,\"y\":33,\"res_timer\":120624},{\"lvl\":9,\"data\":1000006,\"x\":34,\"y\":18},{\"lvl\":9,\"data\":1000006,\"x\":34,\"y\":21},{\"lvl\":8,\"data\":1000002,\"x\":11,\"y\":5,\"res_timer\":120160},{\"lvl\":8,\"data\":1000002,\"x\":25,\"y\":33,\"res_timer\":120716},{\"lvl\":8,\"data\":1000004,\"x\":21,\"y\":5,\"res_timer\":0},{\"lvl\":8,\"data\":1000004,\"x\":15,\"y\":5,\"res_timer\":0},{\"lvl\":8,\"data\":1000004,\"x\":10,\"y\":17,\"res_timer\":120216},{\"lvl\":5,\"data\":1000000,\"x\":8,\"y\":27},{\"lvl\":7,\"data\":1000010,\"x\":13,\"y\":35},{\"lvl\":6,\"data\":1000010,\"x\":37,\"y\":17},{\"lvl\":6,\"data\":1000010,\"x\":37,\"y\":16},{\"lvl\":6,\"data\":1000010,\"x\":37,\"y\":15},{\"lvl\":6,\"data\":1000010,\"x\":37,\"y\":14},{\"lvl\":6,\"data\":1000010,\"x\":37,\"y\":13},{\"lvl\":6,\"data\":1000010,\"x\":37,\"y\":12},{\"lvl\":6,\"data\":1000010,\"x\":36,\"y\":12},{\"lvl\":6,\"data\":1000010,\"x\":35,\"y\":12},{\"lvl\":6,\"data\":1000010,\"x\":34,\"y\":12},{\"lvl\":6,\"data\":1000010,\"x\":33,\"y\":12},{\"lvl\":6,\"data\":1000010,\"x\":32,\"y\":12},{\"lvl\":7,\"data\":1000010,\"x\":13,\"y\":36},{\"lvl\":6,\"data\":1000010,\"x\":31,\"y\":12},{\"lvl\":6,\"data\":1000010,\"x\":30,\"y\":12},{\"lvl\":6,\"data\":1000010,\"x\":29,\"y\":12},{\"lvl\":6,\"data\":1000010,\"x\":28,\"y\":12},{\"lvl\":6,\"data\":1000010,\"x\":27,\"y\":12},{\"lvl\":6,\"data\":1000010,\"x\":27,\"y\":11},{\"lvl\":7,\"data\":1000010,\"x\":14,\"y\":36},{\"lvl\":7,\"data\":1000010,\"x\":15,\"y\":36},{\"lvl\":7,\"data\":1000010,\"x\":16,\"y\":36},{\"lvl\":6,\"data\":1000010,\"x\":27,\"y\":10},{\"lvl\":6,\"data\":1000010,\"x\":27,\"y\":9},{\"lvl\":6,\"data\":1000010,\"x\":27,\"y\":8},{\"lvl\":9,\"data\":1000008,\"x\":24,\"y\":9},{\"lvl\":9,\"data\":1000009,\"x\":14,\"y\":26},{\"lvl\":5,\"data\":1000012,\"x\":13,\"y\":15},{\"lvl\":8,\"data\":1000002,\"x\":24,\"y\":5,\"res_timer\":120218},{\"lvl\":8,\"data\":1000004,\"x\":30,\"y\":13,\"res_timer\":120687},{\"lvl\":5,\"data\":1000011,\"x\":16,\"y\":12},{\"lvl\":2,\"data\":1000020,\"x\":6,\"y\":17},{\"lvl\":8,\"data\":1000004,\"x\":14,\"y\":29,\"res_timer\":120626},{\"lvl\":6,\"data\":1000010,\"x\":27,\"y\":7},{\"lvl\":6,\"data\":1000010,\"x\":27,\"y\":6},{\"lvl\":7,\"data\":1000010,\"x\":17,\"y\":36},{\"lvl\":7,\"data\":1000010,\"x\":18,\"y\":36},{\"lvl\":7,\"data\":1000010,\"x\":19,\"y\":36},{\"lvl\":7,\"data\":1000010,\"x\":20,\"y\":36},{\"lvl\":6,\"data\":1000010,\"x\":27,\"y\":5},{\"lvl\":6,\"data\":1000010,\"x\":27,\"y\":4},{\"lvl\":6,\"data\":1000010,\"x\":26,\"y\":4},{\"lvl\":6,\"data\":1000010,\"x\":25,\"y\":4},{\"lvl\":6,\"data\":1000010,\"x\":24,\"y\":4},{\"lvl\":6,\"data\":1000010,\"x\":23,\"y\":4},{\"lvl\":6,\"data\":1000010,\"x\":22,\"y\":4},{\"lvl\":6,\"data\":1000010,\"x\":21,\"y\":4},{\"lvl\":6,\"data\":1000010,\"x\":20,\"y\":4},{\"lvl\":6,\"data\":1000010,\"x\":19,\"y\":4},{\"lvl\":6,\"data\":1000010,\"x\":18,\"y\":4},{\"lvl\":7,\"data\":1000010,\"x\":21,\"y\":36},{\"lvl\":7,\"data\":1000010,\"x\":22,\"y\":36},{\"lvl\":7,\"data\":1000010,\"x\":23,\"y\":36},{\"lvl\":6,\"data\":1000010,\"x\":17,\"y\":4},{\"lvl\":6,\"data\":1000010,\"x\":16,\"y\":4},{\"lvl\":7,\"data\":1000010,\"x\":24,\"y\":36},{\"lvl\":7,\"data\":1000010,\"x\":25,\"y\":36},{\"lvl\":7,\"data\":1000010,\"x\":26,\"y\":36},{\"lvl\":5,\"data\":1000013,\"x\":24,\"y\":12},{\"lvl\":5,\"data\":1000011,\"x\":27,\"y\":21},{\"lvl\":0,\"data\":1000015,\"x\":11,\"y\":32},{\"lvl\":8,\"data\":1000002,\"x\":18,\"y\":5,\"res_timer\":120217},{\"lvl\":5,\"data\":1000000,\"x\":28,\"y\":7},{\"lvl\":9,\"data\":1000006,\"x\":34,\"y\":24},{\"lvl\":7,\"data\":1000010,\"x\":27,\"y\":36},{\"lvl\":6,\"data\":1000010,\"x\":15,\"y\":4},{\"lvl\":7,\"data\":1000010,\"x\":28,\"y\":36},{\"lvl\":7,\"data\":1000010,\"x\":28,\"y\":35},{\"lvl\":7,\"data\":1000010,\"x\":28,\"y\":34},{\"lvl\":7,\"data\":1000010,\"x\":28,\"y\":33},{\"lvl\":7,\"data\":1000010,\"x\":28,\"y\":32},{\"lvl\":7,\"data\":1000010,\"x\":28,\"y\":31},{\"lvl\":7,\"data\":1000010,\"x\":28,\"y\":30},{\"lvl\":7,\"data\":1000010,\"x\":28,\"y\":29},{\"lvl\":7,\"data\":1000010,\"x\":28,\"y\":28},{\"lvl\":6,\"data\":1000010,\"x\":14,\"y\":4},{\"lvl\":6,\"data\":1000010,\"x\":14,\"y\":5},{\"lvl\":6,\"data\":1000010,\"x\":14,\"y\":6},{\"lvl\":6,\"data\":1000010,\"x\":14,\"y\":7},{\"lvl\":6,\"data\":1000010,\"x\":14,\"y\":8},{\"lvl\":6,\"data\":1000010,\"x\":14,\"y\":9},{\"lvl\":6,\"data\":1000010,\"x\":14,\"y\":10},{\"lvl\":7,\"data\":1000010,\"x\":28,\"y\":27},{\"lvl\":6,\"data\":1000010,\"x\":14,\"y\":12},{\"lvl\":6,\"data\":1000010,\"x\":14,\"y\":11},{\"lvl\":6,\"data\":1000010,\"x\":15,\"y\":13},{\"lvl\":6,\"data\":1000010,\"x\":14,\"y\":13},{\"lvl\":6,\"data\":1000010,\"x\":13,\"y\":13},{\"lvl\":6,\"data\":1000010,\"x\":12,\"y\":13},{\"lvl\":7,\"data\":1000010,\"x\":29,\"y\":27},{\"lvl\":7,\"data\":1000010,\"x\":17,\"y\":25},{\"lvl\":7,\"data\":1000010,\"x\":16,\"y\":25},{\"lvl\":7,\"data\":1000010,\"x\":16,\"y\":24},{\"lvl\":7,\"data\":1000010,\"x\":16,\"y\":23},{\"lvl\":6,\"data\":1000010,\"x\":11,\"y\":13},{\"lvl\":7,\"data\":1000010,\"x\":16,\"y\":22},{\"lvl\":7,\"data\":1000010,\"x\":16,\"y\":21},{\"lvl\":7,\"data\":1000010,\"x\":16,\"y\":20},{\"lvl\":7,\"data\":1000010,\"x\":16,\"y\":19},{\"lvl\":6,\"data\":1000010,\"x\":10,\"y\":13},{\"lvl\":7,\"data\":1000010,\"x\":16,\"y\":18},{\"lvl\":7,\"data\":1000010,\"x\":16,\"y\":17},{\"lvl\":7,\"data\":1000010,\"x\":16,\"y\":16},{\"lvl\":7,\"data\":1000010,\"x\":16,\"y\":15},{\"lvl\":7,\"data\":1000010,\"x\":17,\"y\":15},{\"lvl\":7,\"data\":1000010,\"x\":18,\"y\":15},{\"lvl\":7,\"data\":1000010,\"x\":19,\"y\":15},{\"lvl\":7,\"data\":1000010,\"x\":20,\"y\":15},{\"lvl\":7,\"data\":1000010,\"x\":21,\"y\":15},{\"lvl\":6,\"data\":1000010,\"x\":5,\"y\":24},{\"lvl\":7,\"data\":1000010,\"x\":22,\"y\":15},{\"lvl\":7,\"data\":1000010,\"x\":23,\"y\":15},{\"lvl\":7,\"data\":1000010,\"x\":24,\"y\":15},{\"lvl\":7,\"data\":1000010,\"x\":25,\"y\":15},{\"lvl\":9,\"data\":1000008,\"x\":30,\"y\":24},{\"lvl\":9,\"data\":1000008,\"x\":25,\"y\":29},{\"lvl\":9,\"data\":1000009,\"x\":17,\"y\":22},{\"lvl\":5,\"data\":1000013,\"x\":30,\"y\":16},{\"lvl\":2,\"data\":1000023,\"x\":10,\"y\":20,\"res_timer\":40689},{\"lvl\":5,\"data\":1000012,\"x\":30,\"y\":20},{\"lvl\":3,\"data\":1000024,\"x\":17,\"y\":16},{\"lvl\":3,\"data\":1000026,\"x\":6,\"y\":20},{\"lvl\":0,\"data\":1000022,\"x\":17,\"y\":19},{\"lvl\":2,\"data\":1000028,\"x\":24,\"y\":23},{\"lvl\":0,\"data\":1000015,\"x\":7,\"y\":11},{\"lvl\":10,\"data\":1000005,\"x\":23,\"y\":26},{\"lvl\":10,\"data\":1000003,\"x\":17,\"y\":26},{\"lvl\":6,\"data\":1000010,\"x\":5,\"y\":23},{\"lvl\":6,\"data\":1000010,\"x\":5,\"y\":22},{\"lvl\":6,\"data\":1000010,\"x\":5,\"y\":21},{\"lvl\":6,\"data\":1000010,\"x\":5,\"y\":20},{\"lvl\":6,\"data\":1000010,\"x\":5,\"y\":19},{\"lvl\":6,\"data\":1000010,\"x\":5,\"y\":18},{\"lvl\":6,\"data\":1000010,\"x\":5,\"y\":17},{\"lvl\":7,\"data\":1000010,\"x\":26,\"y\":15},{\"lvl\":7,\"data\":1000010,\"x\":26,\"y\":16},{\"lvl\":7,\"data\":1000010,\"x\":26,\"y\":17},{\"lvl\":7,\"data\":1000010,\"x\":26,\"y\":18},{\"lvl\":6,\"data\":1000010,\"x\":5,\"y\":16},{\"lvl\":6,\"data\":1000010,\"x\":5,\"y\":15},{\"lvl\":6,\"data\":1000010,\"x\":5,\"y\":14},{\"lvl\":6,\"data\":1000010,\"x\":5,\"y\":13},{\"lvl\":6,\"data\":1000010,\"x\":6,\"y\":13},{\"lvl\":6,\"data\":1000010,\"x\":7,\"y\":13},{\"lvl\":6,\"data\":1000010,\"x\":8,\"y\":13},{\"lvl\":6,\"data\":1000010,\"x\":9,\"y\":13},{\"lvl\":6,\"data\":1000010,\"x\":9,\"y\":14},{\"lvl\":6,\"data\":1000010,\"x\":9,\"y\":15},{\"lvl\":6,\"data\":1000010,\"x\":9,\"y\":16},{\"lvl\":6,\"data\":1000010,\"x\":9,\"y\":17},{\"lvl\":6,\"data\":1000010,\"x\":9,\"y\":18},{\"lvl\":6,\"data\":1000010,\"x\":9,\"y\":19},{\"lvl\":6,\"data\":1000010,\"x\":9,\"y\":20},{\"lvl\":6,\"data\":1000010,\"x\":9,\"y\":21},{\"lvl\":7,\"data\":1000010,\"x\":26,\"y\":19},{\"lvl\":7,\"data\":1000010,\"x\":26,\"y\":20},{\"lvl\":7,\"data\":1000010,\"x\":26,\"y\":21},{\"lvl\":7,\"data\":1000010,\"x\":26,\"y\":22},{\"lvl\":7,\"data\":1000010,\"x\":26,\"y\":23},{\"lvl\":7,\"data\":1000010,\"x\":26,\"y\":24},{\"lvl\":6,\"data\":1000010,\"x\":9,\"y\":22},{\"lvl\":7,\"data\":1000010,\"x\":26,\"y\":25},{\"lvl\":6,\"data\":1000010,\"x\":9,\"y\":23},{\"lvl\":6,\"data\":1000010,\"x\":9,\"y\":25},{\"lvl\":6,\"data\":1000010,\"x\":9,\"y\":24},{\"lvl\":6,\"data\":1000010,\"x\":13,\"y\":19},{\"lvl\":6,\"data\":1000010,\"x\":13,\"y\":18},{\"lvl\":6,\"data\":1000010,\"x\":19,\"y\":12},{\"lvl\":6,\"data\":1000010,\"x\":20,\"y\":12},{\"lvl\":7,\"data\":1000010,\"x\":25,\"y\":25},{\"lvl\":7,\"data\":1000010,\"x\":24,\"y\":25},{\"lvl\":7,\"data\":1000010,\"x\":23,\"y\":25},{\"lvl\":7,\"data\":1000010,\"x\":22,\"y\":25},{\"lvl\":7,\"data\":1000010,\"x\":21,\"y\":25},{\"lvl\":7,\"data\":1000010,\"x\":20,\"y\":25},{\"lvl\":7,\"data\":1000010,\"x\":19,\"y\":25},{\"lvl\":7,\"data\":1000010,\"x\":18,\"y\":25},{\"lvl\":9,\"data\":1000009,\"x\":23,\"y\":16},{\"lvl\":5,\"data\":1000013,\"x\":18,\"y\":29},{\"lvl\":5,\"data\":1000012,\"x\":21,\"y\":29},{\"lvl\":5,\"data\":1000011,\"x\":20,\"y\":26},{\"lvl\":2,\"data\":1000023,\"x\":20,\"y\":9,\"res_timer\":40691},{\"lvl\":3,\"data\":1000026,\"x\":6,\"y\":23},{\"lvl\":1,\"data\":1000029,\"x\":6,\"y\":14}],\"obstacles\":[],\"last_news_seen\":155,\"last_league_rank\":13,\"newShopBuildings\":[4,0,6,3,6,3,4,1,5,5,225,3,3,4,1,5,0,0,0,3,1,0,1,2,1,0,2,0,1,1],\"newShopDecos\":[1,4,0,1,1,4,4,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}",
"warVillage": "{\"newShopTraps\":[6,6,3,0,0,4,2,0,2],\"cooldowns\":[],\"last_league_shuffle\":1,\"decos\":[{\"data\":18000031,\"x\":2,\"y\":36},{\"data\":18000011,\"x\":4,\"y\":36},{\"data\":18000027,\"x\":6,\"y\":38},{\"data\":18000012,\"x\":6,\"y\":40},{\"data\":18000033,\"x\":6,\"y\":36}],\"edit_mode_shown\":true,\"buildings\":[{\"lvl\":7,\"data\":1000001,\"x\":20,\"y\":20},{\"lvl\":8,\"data\":1000004,\"x\":11,\"y\":34,\"res_timer\":0},{\"lvl\":5,\"data\":1000000,\"x\":10,\"y\":28},{\"lvl\":0,\"data\":1000015,\"x\":8,\"y\":30},{\"lvl\":3,\"data\":1000014,\"x\":25,\"y\":21},{\"lvl\":9,\"data\":1000008,\"x\":24,\"y\":29},{\"lvl\":0,\"data\":1000015,\"x\":37,\"y\":16},{\"lvl\":8,\"data\":1000002,\"x\":34,\"y\":13,\"res_timer\":120625},{\"lvl\":10,\"data\":1000003,\"x\":12,\"y\":24},{\"lvl\":10,\"data\":1000005,\"x\":16,\"y\":27},{\"lvl\":9,\"data\":1000006,\"x\":11,\"y\":5},{\"lvl\":9,\"data\":1000008,\"x\":18,\"y\":33},{\"lvl\":9,\"data\":1000009,\"x\":20,\"y\":25},{\"lvl\":6,\"data\":1000010,\"x\":30,\"y\":24},{\"lvl\":6,\"data\":1000010,\"x\":31,\"y\":24},{\"lvl\":6,\"data\":1000010,\"x\":32,\"y\":24},{\"lvl\":6,\"data\":1000010,\"x\":32,\"y\":23},{\"lvl\":6,\"data\":1000010,\"x\":32,\"y\":22},{\"lvl\":6,\"data\":1000010,\"x\":32,\"y\":21},{\"lvl\":6,\"data\":1000010,\"x\":15,\"y\":28},{\"lvl\":6,\"data\":1000010,\"x\":15,\"y\":29},{\"lvl\":6,\"data\":1000010,\"x\":15,\"y\":30},{\"lvl\":6,\"data\":1000010,\"x\":15,\"y\":31},{\"lvl\":6,\"data\":1000010,\"x\":15,\"y\":32},{\"lvl\":6,\"data\":1000010,\"x\":15,\"y\":33},{\"lvl\":6,\"data\":1000010,\"x\":15,\"y\":34},{\"lvl\":6,\"data\":1000010,\"x\":15,\"y\":35},{\"lvl\":6,\"data\":1000010,\"x\":16,\"y\":35},{\"lvl\":6,\"data\":1000010,\"x\":16,\"y\":36},{\"lvl\":6,\"data\":1000010,\"x\":17,\"y\":36},{\"lvl\":6,\"data\":1000010,\"x\":18,\"y\":36},{\"lvl\":6,\"data\":1000010,\"x\":19,\"y\":36},{\"lvl\":6,\"data\":1000010,\"x\":20,\"y\":36},{\"lvl\":6,\"data\":1000010,\"x\":21,\"y\":36},{\"lvl\":6,\"data\":1000010,\"x\":22,\"y\":36},{\"lvl\":6,\"data\":1000010,\"x\":23,\"y\":36},{\"lvl\":6,\"data\":1000010,\"x\":24,\"y\":36},{\"lvl\":6,\"data\":1000010,\"x\":25,\"y\":36},{\"lvl\":7,\"data\":1000010,\"x\":7,\"y\":21},{\"lvl\":7,\"data\":1000010,\"x\":7,\"y\":20},{\"lvl\":7,\"data\":1000010,\"x\":7,\"y\":19},{\"lvl\":7,\"data\":1000010,\"x\":7,\"y\":18},{\"lvl\":6,\"data\":1000010,\"x\":26,\"y\":36},{\"lvl\":6,\"data\":1000010,\"x\":26,\"y\":35},{\"lvl\":6,\"data\":1000010,\"x\":27,\"y\":35},{\"lvl\":6,\"data\":1000010,\"x\":27,\"y\":34},{\"lvl\":6,\"data\":1000010,\"x\":27,\"y\":33},{\"lvl\":6,\"data\":1000010,\"x\":27,\"y\":32},{\"lvl\":7,\"data\":1000010,\"x\":27,\"y\":31},{\"lvl\":7,\"data\":1000010,\"x\":27,\"y\":30},{\"lvl\":7,\"data\":1000010,\"x\":7,\"y\":17},{\"lvl\":7,\"data\":1000010,\"x\":27,\"y\":29},{\"lvl\":7,\"data\":1000010,\"x\":23,\"y\":29},{\"lvl\":7,\"data\":1000010,\"x\":23,\"y\":30},{\"lvl\":7,\"data\":1000010,\"x\":23,\"y\":31},{\"lvl\":6,\"data\":1000010,\"x\":23,\"y\":32},{\"lvl\":6,\"data\":1000010,\"x\":22,\"y\":32},{\"lvl\":6,\"data\":1000010,\"x\":21,\"y\":32},{\"lvl\":6,\"data\":1000010,\"x\":20,\"y\":32},{\"lvl\":6,\"data\":1000010,\"x\":19,\"y\":32},{\"lvl\":6,\"data\":1000010,\"x\":19,\"y\":29},{\"lvl\":6,\"data\":1000010,\"x\":19,\"y\":31},{\"lvl\":6,\"data\":1000010,\"x\":19,\"y\":30},{\"lvl\":5,\"data\":1000000,\"x\":11,\"y\":10},{\"lvl\":5,\"data\":1000013,\"x\":20,\"y\":29},{\"lvl\":5,\"data\":1000007,\"x\":7,\"y\":6},{\"lvl\":10,\"data\":1000005,\"x\":17,\"y\":12},{\"lvl\":10,\"data\":1000003,\"x\":27,\"y\":25},{\"lvl\":9,\"data\":1000009,\"x\":16,\"y\":20},{\"lvl\":6,\"data\":1000010,\"x\":19,\"y\":26},{\"lvl\":6,\"data\":1000010,\"x\":19,\"y\":27},{\"lvl\":7,\"data\":1000010,\"x\":7,\"y\":16},{\"lvl\":7,\"data\":1000010,\"x\":8,\"y\":16},{\"lvl\":7,\"data\":1000010,\"x\":8,\"y\":15},{\"lvl\":7,\"data\":1000010,\"x\":9,\"y\":15},{\"lvl\":6,\"data\":1000010,\"x\":19,\"y\":28},{\"lvl\":6,\"data\":1000010,\"x\":20,\"y\":28},{\"lvl\":6,\"data\":1000010,\"x\":21,\"y\":28},{\"lvl\":6,\"data\":1000010,\"x\":22,\"y\":28},{\"lvl\":6,\"data\":1000010,\"x\":23,\"y\":28},{\"lvl\":6,\"data\":1000010,\"x\":24,\"y\":28},{\"lvl\":6,\"data\":1000010,\"x\":25,\"y\":28},{\"lvl\":6,\"data\":1000010,\"x\":26,\"y\":28},{\"lvl\":6,\"data\":1000010,\"x\":27,\"y\":28},{\"lvl\":6,\"data\":1000010,\"x\":28,\"y\":28},{\"lvl\":6,\"data\":1000010,\"x\":29,\"y\":28},{\"lvl\":6,\"data\":1000010,\"x\":30,\"y\":28},{\"lvl\":6,\"data\":1000010,\"x\":31,\"y\":28},{\"lvl\":6,\"data\":1000010,\"x\":32,\"y\":28},{\"lvl\":6,\"data\":1000010,\"x\":33,\"y\":28},{\"lvl\":6,\"data\":1000010,\"x\":34,\"y\":28},{\"lvl\":7,\"data\":1000010,\"x\":10,\"y\":15},{\"lvl\":7,\"data\":1000010,\"x\":11,\"y\":15},{\"lvl\":7,\"data\":1000010,\"x\":12,\"y\":15},{\"lvl\":8,\"data\":1000002,\"x\":5,\"y\":27,\"res_timer\":120624},{\"lvl\":9,\"data\":1000006,\"x\":5,\"y\":12},{\"lvl\":9,\"data\":1000006,\"x\":4,\"y\":17},{\"lvl\":8,\"data\":1000002,\"x\":23,\"y\":37,\"res_timer\":120160},{\"lvl\":8,\"data\":1000002,\"x\":35,\"y\":29,\"res_timer\":120716},{\"lvl\":8,\"data\":1000004,\"x\":18,\"y\":37,\"res_timer\":0},{\"lvl\":8,\"data\":1000004,\"x\":28,\"y\":36,\"res_timer\":0},{\"lvl\":8,\"data\":1000004,\"x\":24,\"y\":32,\"res_timer\":120216},{\"lvl\":5,\"data\":1000000,\"x\":29,\"y\":11},{\"lvl\":7,\"data\":1000010,\"x\":13,\"y\":15},{\"lvl\":6,\"data\":1000010,\"x\":35,\"y\":28},{\"lvl\":6,\"data\":1000010,\"x\":35,\"y\":27},{\"lvl\":6,\"data\":1000010,\"x\":36,\"y\":27},{\"lvl\":6,\"data\":1000010,\"x\":36,\"y\":26},{\"lvl\":6,\"data\":1000010,\"x\":36,\"y\":25},{\"lvl\":6,\"data\":1000010,\"x\":36,\"y\":24},{\"lvl\":6,\"data\":1000010,\"x\":36,\"y\":23},{\"lvl\":6,\"data\":1000010,\"x\":36,\"y\":22},{\"lvl\":6,\"data\":1000010,\"x\":36,\"y\":21},{\"lvl\":6,\"data\":1000010,\"x\":36,\"y\":20},{\"lvl\":6,\"data\":1000010,\"x\":36,\"y\":19},{\"lvl\":7,\"data\":1000010,\"x\":14,\"y\":15},{\"lvl\":6,\"data\":1000010,\"x\":36,\"y\":18},{\"lvl\":6,\"data\":1000010,\"x\":36,\"y\":17},{\"lvl\":6,\"data\":1000010,\"x\":36,\"y\":16},{\"lvl\":6,\"data\":1000010,\"x\":35,\"y\":16},{\"lvl\":6,\"data\":1000010,\"x\":34,\"y\":16},{\"lvl\":6,\"data\":1000010,\"x\":30,\"y\":16},{\"lvl\":7,\"data\":1000010,\"x\":15,\"y\":15},{\"lvl\":7,\"data\":1000010,\"x\":16,\"y\":15},{\"lvl\":7,\"data\":1000010,\"x\":16,\"y\":14},{\"lvl\":6,\"data\":1000010,\"x\":31,\"y\":16},{\"lvl\":6,\"data\":1000010,\"x\":32,\"y\":16},{\"lvl\":6,\"data\":1000010,\"x\":29,\"y\":16},{\"lvl\":9,\"data\":1000008,\"x\":22,\"y\":8},{\"lvl\":9,\"data\":1000009,\"x\":10,\"y\":16},{\"lvl\":5,\"data\":1000012,\"x\":24,\"y\":25},{\"lvl\":8,\"data\":1000002,\"x\":21,\"y\":33,\"res_timer\":120218},{\"lvl\":8,\"data\":1000004,\"x\":8,\"y\":22,\"res_timer\":120687},{\"lvl\":5,\"data\":1000011,\"x\":16,\"y\":30},{\"lvl\":2,\"data\":1000020,\"x\":37,\"y\":19},{\"lvl\":8,\"data\":1000004,\"x\":32,\"y\":25,\"res_timer\":120626},{\"lvl\":6,\"data\":1000010,\"x\":32,\"y\":17},{\"lvl\":6,\"data\":1000010,\"x\":33,\"y\":16},{\"lvl\":7,\"data\":1000010,\"x\":16,\"y\":13},{\"lvl\":7,\"data\":1000010,\"x\":16,\"y\":12},{\"lvl\":7,\"data\":1000010,\"x\":16,\"y\":11},{\"lvl\":7,\"data\":1000010,\"x\":16,\"y\":10},{\"lvl\":6,\"data\":1000010,\"x\":32,\"y\":20},{\"lvl\":6,\"data\":1000010,\"x\":31,\"y\":20},{\"lvl\":6,\"data\":1000010,\"x\":30,\"y\":20},{\"lvl\":6,\"data\":1000010,\"x\":29,\"y\":20},{\"lvl\":6,\"data\":1000010,\"x\":20,\"y\":14},{\"lvl\":6,\"data\":1000010,\"x\":20,\"y\":13},{\"lvl\":6,\"data\":1000010,\"x\":20,\"y\":12},{\"lvl\":6,\"data\":1000010,\"x\":20,\"y\":11},{\"lvl\":6,\"data\":1000010,\"x\":21,\"y\":11},{\"lvl\":6,\"data\":1000010,\"x\":22,\"y\":11},{\"lvl\":6,\"data\":1000010,\"x\":23,\"y\":11},{\"lvl\":7,\"data\":1000010,\"x\":16,\"y\":9},{\"lvl\":7,\"data\":1000010,\"x\":16,\"y\":8},{\"lvl\":7,\"data\":1000010,\"x\":17,\"y\":8},{\"lvl\":6,\"data\":1000010,\"x\":24,\"y\":11},{\"lvl\":6,\"data\":1000010,\"x\":24,\"y\":12},{\"lvl\":7,\"data\":1000010,\"x\":17,\"y\":7},{\"lvl\":7,\"data\":1000010,\"x\":18,\"y\":7},{\"lvl\":7,\"data\":1000010,\"x\":19,\"y\":7},{\"lvl\":5,\"data\":1000013,\"x\":29,\"y\":21},{\"lvl\":5,\"data\":1000011,\"x\":17,\"y\":9},{\"lvl\":0,\"data\":1000015,\"x\":8,\"y\":11},{\"lvl\":8,\"data\":1000002,\"x\":33,\"y\":20,\"res_timer\":120217},{\"lvl\":5,\"data\":1000000,\"x\":28,\"y\":29},{\"lvl\":9,\"data\":1000006,\"x\":4,\"y\":22},{\"lvl\":7,\"data\":1000010,\"x\":20,\"y\":7},{\"lvl\":6,\"data\":1000010,\"x\":24,\"y\":13},{\"lvl\":7,\"data\":1000010,\"x\":21,\"y\":7},{\"lvl\":7,\"data\":1000010,\"x\":22,\"y\":7},{\"lvl\":7,\"data\":1000010,\"x\":23,\"y\":7},{\"lvl\":7,\"data\":1000010,\"x\":24,\"y\":7},{\"lvl\":7,\"data\":1000010,\"x\":25,\"y\":7},{\"lvl\":7,\"data\":1000010,\"x\":26,\"y\":7},{\"lvl\":7,\"data\":1000010,\"x\":27,\"y\":7},{\"lvl\":7,\"data\":1000010,\"x\":27,\"y\":8},{\"lvl\":7,\"data\":1000010,\"x\":28,\"y\":8},{\"lvl\":6,\"data\":1000010,\"x\":24,\"y\":14},{\"lvl\":6,\"data\":1000010,\"x\":24,\"y\":18},{\"lvl\":6,\"data\":1000010,\"x\":24,\"y\":17},{\"lvl\":6,\"data\":1000010,\"x\":24,\"y\":16},{\"lvl\":6,\"data\":1000010,\"x\":24,\"y\":15},{\"lvl\":6,\"data\":1000010,\"x\":23,\"y\":15},{\"lvl\":6,\"data\":1000010,\"x\":22,\"y\":15},{\"lvl\":7,\"data\":1000010,\"x\":28,\"y\":9},{\"lvl\":6,\"data\":1000010,\"x\":21,\"y\":15},{\"lvl\":6,\"data\":1000010,\"x\":20,\"y\":15},{\"lvl\":6,\"data\":1000010,\"x\":19,\"y\":15},{\"lvl\":6,\"data\":1000010,\"x\":18,\"y\":15},{\"lvl\":6,\"data\":1000010,\"x\":17,\"y\":15},{\"lvl\":6,\"data\":1000010,\"x\":11,\"y\":24},{\"lvl\":7,\"data\":1000010,\"x\":28,\"y\":10},{\"lvl\":7,\"data\":1000010,\"x\":28,\"y\":11},{\"lvl\":7,\"data\":1000010,\"x\":28,\"y\":12},{\"lvl\":7,\"data\":1000010,\"x\":28,\"y\":13},{\"lvl\":7,\"data\":1000010,\"x\":28,\"y\":14},{\"lvl\":6,\"data\":1000010,\"x\":15,\"y\":24},{\"lvl\":7,\"data\":1000010,\"x\":28,\"y\":15},{\"lvl\":7,\"data\":1000010,\"x\":28,\"y\":16},{\"lvl\":7,\"data\":1000010,\"x\":28,\"y\":17},{\"lvl\":7,\"data\":1000010,\"x\":28,\"y\":18},{\"lvl\":6,\"data\":1000010,\"x\":15,\"y\":25},{\"lvl\":7,\"data\":1000010,\"x\":28,\"y\":19},{\"lvl\":7,\"data\":1000010,\"x\":28,\"y\":20},{\"lvl\":7,\"data\":1000010,\"x\":28,\"y\":21},{\"lvl\":7,\"data\":1000010,\"x\":28,\"y\":22},{\"lvl\":7,\"data\":1000010,\"x\":28,\"y\":23},{\"lvl\":7,\"data\":1000010,\"x\":28,\"y\":24},{\"lvl\":7,\"data\":1000010,\"x\":27,\"y\":24},{\"lvl\":7,\"data\":1000010,\"x\":26,\"y\":24},{\"lvl\":7,\"data\":1000010,\"x\":25,\"y\":24},{\"lvl\":6,\"data\":1000010,\"x\":15,\"y\":26},{\"lvl\":7,\"data\":1000010,\"x\":21,\"y\":19},{\"lvl\":7,\"data\":1000010,\"x\":22,\"y\":19},{\"lvl\":7,\"data\":1000010,\"x\":23,\"y\":19},{\"lvl\":7,\"data\":1000010,\"x\":24,\"y\":19},{\"lvl\":9,\"data\":1000008,\"x\":33,\"y\":17},{\"lvl\":9,\"data\":1000008,\"x\":8,\"y\":19},{\"lvl\":9,\"data\":1000009,\"x\":21,\"y\":16},{\"lvl\":5,\"data\":1000013,\"x\":12,\"y\":20},{\"lvl\":2,\"data\":1000023,\"x\":37,\"y\":24,\"res_timer\":40689},{\"lvl\":5,\"data\":1000012,\"x\":16,\"y\":24},{\"lvl\":3,\"data\":1000024,\"x\":25,\"y\":18},{\"lvl\":3,\"data\":1000026,\"x\":20,\"y\":4},{\"lvl\":0,\"data\":1000022,\"x\":25,\"y\":15},{\"lvl\":2,\"data\":1000028,\"x\":16,\"y\":17},{\"lvl\":0,\"data\":1000015,\"x\":16,\"y\":37},{\"lvl\":10,\"data\":1000005,\"x\":25,\"y\":12},{\"lvl\":10,\"data\":1000003,\"x\":13,\"y\":16},{\"lvl\":6,\"data\":1000010,\"x\":15,\"y\":27},{\"lvl\":6,\"data\":1000010,\"x\":14,\"y\":27},{\"lvl\":6,\"data\":1000010,\"x\":13,\"y\":27},{\"lvl\":6,\"data\":1000010,\"x\":12,\"y\":27},{\"lvl\":6,\"data\":1000010,\"x\":11,\"y\":27},{\"lvl\":6,\"data\":1000010,\"x\":10,\"y\":27},{\"lvl\":6,\"data\":1000010,\"x\":9,\"y\":27},{\"lvl\":7,\"data\":1000010,\"x\":24,\"y\":20},{\"lvl\":7,\"data\":1000010,\"x\":24,\"y\":21},{\"lvl\":7,\"data\":1000010,\"x\":24,\"y\":22},{\"lvl\":7,\"data\":1000010,\"x\":24,\"y\":23},{\"lvl\":6,\"data\":1000010,\"x\":8,\"y\":27},{\"lvl\":6,\"data\":1000010,\"x\":8,\"y\":26},{\"lvl\":6,\"data\":1000010,\"x\":7,\"y\":26},{\"lvl\":6,\"data\":1000010,\"x\":15,\"y\":20},{\"lvl\":6,\"data\":1000010,\"x\":15,\"y\":21},{\"lvl\":6,\"data\":1000010,\"x\":29,\"y\":24},{\"lvl\":6,\"data\":1000010,\"x\":15,\"y\":23},{\"lvl\":6,\"data\":1000010,\"x\":14,\"y\":23},{\"lvl\":6,\"data\":1000010,\"x\":13,\"y\":23},{\"lvl\":6,\"data\":1000010,\"x\":12,\"y\":23},{\"lvl\":6,\"data\":1000010,\"x\":11,\"y\":23},{\"lvl\":6,\"data\":1000010,\"x\":15,\"y\":22},{\"lvl\":6,\"data\":1000010,\"x\":17,\"y\":19},{\"lvl\":6,\"data\":1000010,\"x\":16,\"y\":19},{\"lvl\":6,\"data\":1000010,\"x\":15,\"y\":19},{\"lvl\":6,\"data\":1000010,\"x\":14,\"y\":19},{\"lvl\":7,\"data\":1000010,\"x\":24,\"y\":24},{\"lvl\":7,\"data\":1000010,\"x\":23,\"y\":24},{\"lvl\":7,\"data\":1000010,\"x\":22,\"y\":24},{\"lvl\":7,\"data\":1000010,\"x\":21,\"y\":24},{\"lvl\":7,\"data\":1000010,\"x\":20,\"y\":24},{\"lvl\":7,\"data\":1000010,\"x\":13,\"y\":19},{\"lvl\":6,\"data\":1000010,\"x\":12,\"y\":19},{\"lvl\":7,\"data\":1000010,\"x\":11,\"y\":19},{\"lvl\":6,\"data\":1000010,\"x\":11,\"y\":20},{\"lvl\":6,\"data\":1000010,\"x\":11,\"y\":21},{\"lvl\":6,\"data\":1000010,\"x\":11,\"y\":22},{\"lvl\":6,\"data\":1000010,\"x\":7,\"y\":25},{\"lvl\":6,\"data\":1000010,\"x\":7,\"y\":24},{\"lvl\":6,\"data\":1000010,\"x\":7,\"y\":23},{\"lvl\":6,\"data\":1000010,\"x\":7,\"y\":22},{\"lvl\":7,\"data\":1000010,\"x\":19,\"y\":25},{\"lvl\":7,\"data\":1000010,\"x\":19,\"y\":24},{\"lvl\":7,\"data\":1000010,\"x\":19,\"y\":23},{\"lvl\":7,\"data\":1000010,\"x\":19,\"y\":22},{\"lvl\":7,\"data\":1000010,\"x\":19,\"y\":21},{\"lvl\":7,\"data\":1000010,\"x\":19,\"y\":20},{\"lvl\":7,\"data\":1000010,\"x\":19,\"y\":19},{\"lvl\":7,\"data\":1000010,\"x\":20,\"y\":19},{\"lvl\":9,\"data\":1000009,\"x\":29,\"y\":17},{\"lvl\":5,\"data\":1000013,\"x\":21,\"y\":12},{\"lvl\":5,\"data\":1000012,\"x\":18,\"y\":16},{\"lvl\":5,\"data\":1000011,\"x\":25,\"y\":9},{\"lvl\":2,\"data\":1000023,\"x\":29,\"y\":7,\"res_timer\":40691},{\"lvl\":3,\"data\":1000026,\"x\":15,\"y\":4},{\"lvl\":1,\"data\":1000029,\"x\":25,\"y\":4}],\"obstacles\":[],\"last_news_seen\":155,\"last_league_rank\":13,\"newShopBuildings\":[4,0,6,3,6,3,4,1,5,5,225,3,3,4,1,5,0,0,0,3,1,0,1,2,1,0,2,0,1,1],\"newShopDecos\":[1,4,0,1,1,4,4,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}"
}
That's the JSON file and whenever I try to retrieve the data by doing the following:
$randomVar = $data['villageJson']['buildings'];
It returns an error saying 'buildings' is ... offset.
So what I did is what you guys probably know is I googled why it was doing that by doing a JSON Beautifier search and what showed was an error message saying that it was not a json. Which made me scratch my head for a bit and when I remove the double quotes encapsulating the entire 'villageJson' content it now said "Strings should be wrapped in double quotes". So I came into a conclusion that this is a json string and I have to turn it into a JSON before I could call any array.
So now for the question. How do I turn this JSON String to a JSON? I had an alternative in mind by just using a search function in php and I would get my value that way but that's only if I can't get any answers here.
THanks in advanced!
$str = '{"villageJson": "{\"newShopTraps\":[6,6,3,0,0,4,2,0,2],\"cooldowns\":[],\"last_league_shuffle\":1,\"decos\":[{\"data\":18000031,\"x\":2,\"y\":36},{\"data\":18000011,\"x\":4,\"y\":36},{\"data\":18000027,\"x\":6,\"y\":38},{\"data\":18000012,\"x\":6,\"y\":40},{\"data\":18000033,\"x\":6,\"y\":36}],\"edit_mode_shown\":true,\"buildings\":[{\"lvl\":7,\"data\":1000001,\"x\":20,\"y\":19},{\"lvl\":8,\"data\":1000004,\"x\":22,\"y\":33,\"res_timer\":0},{\"lvl\":5,\"data\":1000000,\"x\":9,\"y\":8},{\"lvl\":0,\"data\":1000015,\"x\":28,\"y\":5},{\"lvl\":3,\"data\":1000014,\"x\":20,\"y\":16},{\"lvl\":9,\"data\":1000008,\"x\":10,\"y\":23},{\"lvl\":0,\"data\":1000015,\"x\":34,\"y\":28},{\"lvl\":8,\"data\":1000002,\"x\":16,\"y\":33,\"res_timer\":120625},{\"lvl\":10,\"data\":1000003,\"x\":21,\"y\":12},{\"lvl\":10,\"data\":1000005,\"x\":13,\"y\":20},{\"lvl\":9,\"data\":1000006,\"x\":34,\"y\":15},{\"lvl\":9,\"data\":1000008,\"x\":10,\"y\":14},{\"lvl\":9,\"data\":1000009,\"x\":15,\"y\":9},{\"lvl\":6,\"data\":1000010,\"x\":25,\"y\":8},{\"lvl\":6,\"data\":1000010,\"x\":24,\"y\":8},{\"lvl\":6,\"data\":1000010,\"x\":23,\"y\":8},{\"lvl\":6,\"data\":1000010,\"x\":22,\"y\":8},{\"lvl\":6,\"data\":1000010,\"x\":21,\"y\":8},{\"lvl\":6,\"data\":1000010,\"x\":20,\"y\":8},{\"lvl\":6,\"data\":1000010,\"x\":19,\"y\":8},{\"lvl\":6,\"data\":1000010,\"x\":18,\"y\":8},{\"lvl\":6,\"data\":1000010,\"x\":17,\"y\":8},{\"lvl\":6,\"data\":1000010,\"x\":16,\"y\":8},{\"lvl\":6,\"data\":1000010,\"x\":15,\"y\":8},{\"lvl\":6,\"data\":1000010,\"x\":27,\"y\":32},{\"lvl\":6,\"data\":1000010,\"x\":26,\"y\":32},{\"lvl\":6,\"data\":1000010,\"x\":25,\"y\":32},{\"lvl\":6,\"data\":1000010,\"x\":24,\"y\":32},{\"lvl\":6,\"data\":1000010,\"x\":23,\"y\":32},{\"lvl\":6,\"data\":1000010,\"x\":22,\"y\":32},{\"lvl\":6,\"data\":1000010,\"x\":21,\"y\":32},{\"lvl\":6,\"data\":1000010,\"x\":20,\"y\":32},{\"lvl\":6,\"data\":1000010,\"x\":19,\"y\":32},{\"lvl\":6,\"data\":1000010,\"x\":18,\"y\":32},{\"lvl\":6,\"data\":1000010,\"x\":17,\"y\":32},{\"lvl\":6,\"data\":1000010,\"x\":16,\"y\":32},{\"lvl\":6,\"data\":1000010,\"x\":14,\"y\":32},{\"lvl\":6,\"data\":1000010,\"x\":15,\"y\":32},{\"lvl\":7,\"data\":1000010,\"x\":5,\"y\":25},{\"lvl\":7,\"data\":1000010,\"x\":5,\"y\":26},{\"lvl\":7,\"data\":1000010,\"x\":6,\"y\":26},{\"lvl\":7,\"data\":1000010,\"x\":7,\"y\":26},{\"lvl\":6,\"data\":1000010,\"x\":26,\"y\":8},{\"lvl\":6,\"data\":1000010,\"x\":33,\"y\":13},{\"lvl\":6,\"data\":1000010,\"x\":33,\"y\":14},{\"lvl\":6,\"data\":1000010,\"x\":33,\"y\":15},{\"lvl\":6,\"data\":1000010,\"x\":33,\"y\":16},{\"lvl\":6,\"data\":1000010,\"x\":33,\"y\":17},{\"lvl\":7,\"data\":1000010,\"x\":8,\"y\":26},{\"lvl\":7,\"data\":1000010,\"x\":9,\"y\":26},{\"lvl\":7,\"data\":1000010,\"x\":10,\"y\":26},{\"lvl\":7,\"data\":1000010,\"x\":11,\"y\":26},{\"lvl\":7,\"data\":1000010,\"x\":12,\"y\":26},{\"lvl\":7,\"data\":1000010,\"x\":13,\"y\":26},{\"lvl\":7,\"data\":1000010,\"x\":13,\"y\":27},{\"lvl\":6,\"data\":1000010,\"x\":33,\"y\":18},{\"lvl\":6,\"data\":1000010,\"x\":33,\"y\":19},{\"lvl\":6,\"data\":1000010,\"x\":33,\"y\":20},{\"lvl\":6,\"data\":1000010,\"x\":33,\"y\":21},{\"lvl\":6,\"data\":1000010,\"x\":33,\"y\":22},{\"lvl\":6,\"data\":1000010,\"x\":33,\"y\":23},{\"lvl\":6,\"data\":1000010,\"x\":33,\"y\":24},{\"lvl\":6,\"data\":1000010,\"x\":33,\"y\":25},{\"lvl\":5,\"data\":1000000,\"x\":29,\"y\":28},{\"lvl\":5,\"data\":1000013,\"x\":13,\"y\":23},{\"lvl\":5,\"data\":1000007,\"x\":29,\"y\":33},{\"lvl\":10,\"data\":1000005,\"x\":27,\"y\":16},{\"lvl\":10,\"data\":1000003,\"x\":27,\"y\":24},{\"lvl\":9,\"data\":1000009,\"x\":27,\"y\":13},{\"lvl\":6,\"data\":1000010,\"x\":33,\"y\":26},{\"lvl\":6,\"data\":1000010,\"x\":30,\"y\":27},{\"lvl\":7,\"data\":1000010,\"x\":13,\"y\":28},{\"lvl\":7,\"data\":1000010,\"x\":13,\"y\":29},{\"lvl\":7,\"data\":1000010,\"x\":13,\"y\":30},{\"lvl\":7,\"data\":1000010,\"x\":13,\"y\":31},{\"lvl\":6,\"data\":1000010,\"x\":31,\"y\":27},{\"lvl\":6,\"data\":1000010,\"x\":32,\"y\":27},{\"lvl\":6,\"data\":1000010,\"x\":33,\"y\":27},{\"lvl\":6,\"data\":1000010,\"x\":34,\"y\":27},{\"lvl\":6,\"data\":1000010,\"x\":35,\"y\":27},{\"lvl\":6,\"data\":1000010,\"x\":36,\"y\":27},{\"lvl\":6,\"data\":1000010,\"x\":37,\"y\":27},{\"lvl\":6,\"data\":1000010,\"x\":37,\"y\":26},{\"lvl\":6,\"data\":1000010,\"x\":37,\"y\":25},{\"lvl\":6,\"data\":1000010,\"x\":37,\"y\":24},{\"lvl\":6,\"data\":1000010,\"x\":37,\"y\":23},{\"lvl\":6,\"data\":1000010,\"x\":37,\"y\":22},{\"lvl\":6,\"data\":1000010,\"x\":37,\"y\":21},{\"lvl\":6,\"data\":1000010,\"x\":37,\"y\":20},{\"lvl\":6,\"data\":1000010,\"x\":37,\"y\":19},{\"lvl\":6,\"data\":1000010,\"x\":37,\"y\":18},{\"lvl\":7,\"data\":1000010,\"x\":13,\"y\":32},{\"lvl\":7,\"data\":1000010,\"x\":13,\"y\":33},{\"lvl\":7,\"data\":1000010,\"x\":13,\"y\":34},{\"lvl\":8,\"data\":1000002,\"x\":19,\"y\":33,\"res_timer\":120624},{\"lvl\":9,\"data\":1000006,\"x\":34,\"y\":18},{\"lvl\":9,\"data\":1000006,\"x\":34,\"y\":21},{\"lvl\":8,\"data\":1000002,\"x\":11,\"y\":5,\"res_timer\":120160},{\"lvl\":8,\"data\":1000002,\"x\":25,\"y\":33,\"res_timer\":120716},{\"lvl\":8,\"data\":1000004,\"x\":21,\"y\":5,\"res_timer\":0},{\"lvl\":8,\"data\":1000004,\"x\":15,\"y\":5,\"res_timer\":0},{\"lvl\":8,\"data\":1000004,\"x\":10,\"y\":17,\"res_timer\":120216},{\"lvl\":5,\"data\":1000000,\"x\":8,\"y\":27},{\"lvl\":7,\"data\":1000010,\"x\":13,\"y\":35},{\"lvl\":6,\"data\":1000010,\"x\":37,\"y\":17},{\"lvl\":6,\"data\":1000010,\"x\":37,\"y\":16},{\"lvl\":6,\"data\":1000010,\"x\":37,\"y\":15},{\"lvl\":6,\"data\":1000010,\"x\":37,\"y\":14},{\"lvl\":6,\"data\":1000010,\"x\":37,\"y\":13},{\"lvl\":6,\"data\":1000010,\"x\":37,\"y\":12},{\"lvl\":6,\"data\":1000010,\"x\":36,\"y\":12},{\"lvl\":6,\"data\":1000010,\"x\":35,\"y\":12},{\"lvl\":6,\"data\":1000010,\"x\":34,\"y\":12},{\"lvl\":6,\"data\":1000010,\"x\":33,\"y\":12},{\"lvl\":6,\"data\":1000010,\"x\":32,\"y\":12},{\"lvl\":7,\"data\":1000010,\"x\":13,\"y\":36},{\"lvl\":6,\"data\":1000010,\"x\":31,\"y\":12},{\"lvl\":6,\"data\":1000010,\"x\":30,\"y\":12},{\"lvl\":6,\"data\":1000010,\"x\":29,\"y\":12},{\"lvl\":6,\"data\":1000010,\"x\":28,\"y\":12},{\"lvl\":6,\"data\":1000010,\"x\":27,\"y\":12},{\"lvl\":6,\"data\":1000010,\"x\":27,\"y\":11},{\"lvl\":7,\"data\":1000010,\"x\":14,\"y\":36},{\"lvl\":7,\"data\":1000010,\"x\":15,\"y\":36},{\"lvl\":7,\"data\":1000010,\"x\":16,\"y\":36},{\"lvl\":6,\"data\":1000010,\"x\":27,\"y\":10},{\"lvl\":6,\"data\":1000010,\"x\":27,\"y\":9},{\"lvl\":6,\"data\":1000010,\"x\":27,\"y\":8},{\"lvl\":9,\"data\":1000008,\"x\":24,\"y\":9},{\"lvl\":9,\"data\":1000009,\"x\":14,\"y\":26},{\"lvl\":5,\"data\":1000012,\"x\":13,\"y\":15},{\"lvl\":8,\"data\":1000002,\"x\":24,\"y\":5,\"res_timer\":120218},{\"lvl\":8,\"data\":1000004,\"x\":30,\"y\":13,\"res_timer\":120687},{\"lvl\":5,\"data\":1000011,\"x\":16,\"y\":12},{\"lvl\":2,\"data\":1000020,\"x\":6,\"y\":17},{\"lvl\":8,\"data\":1000004,\"x\":14,\"y\":29,\"res_timer\":120626},{\"lvl\":6,\"data\":1000010,\"x\":27,\"y\":7},{\"lvl\":6,\"data\":1000010,\"x\":27,\"y\":6},{\"lvl\":7,\"data\":1000010,\"x\":17,\"y\":36},{\"lvl\":7,\"data\":1000010,\"x\":18,\"y\":36},{\"lvl\":7,\"data\":1000010,\"x\":19,\"y\":36},{\"lvl\":7,\"data\":1000010,\"x\":20,\"y\":36},{\"lvl\":6,\"data\":1000010,\"x\":27,\"y\":5},{\"lvl\":6,\"data\":1000010,\"x\":27,\"y\":4},{\"lvl\":6,\"data\":1000010,\"x\":26,\"y\":4},{\"lvl\":6,\"data\":1000010,\"x\":25,\"y\":4},{\"lvl\":6,\"data\":1000010,\"x\":24,\"y\":4},{\"lvl\":6,\"data\":1000010,\"x\":23,\"y\":4},{\"lvl\":6,\"data\":1000010,\"x\":22,\"y\":4},{\"lvl\":6,\"data\":1000010,\"x\":21,\"y\":4},{\"lvl\":6,\"data\":1000010,\"x\":20,\"y\":4},{\"lvl\":6,\"data\":1000010,\"x\":19,\"y\":4},{\"lvl\":6,\"data\":1000010,\"x\":18,\"y\":4},{\"lvl\":7,\"data\":1000010,\"x\":21,\"y\":36},{\"lvl\":7,\"data\":1000010,\"x\":22,\"y\":36},{\"lvl\":7,\"data\":1000010,\"x\":23,\"y\":36},{\"lvl\":6,\"data\":1000010,\"x\":17,\"y\":4},{\"lvl\":6,\"data\":1000010,\"x\":16,\"y\":4},{\"lvl\":7,\"data\":1000010,\"x\":24,\"y\":36},{\"lvl\":7,\"data\":1000010,\"x\":25,\"y\":36},{\"lvl\":7,\"data\":1000010,\"x\":26,\"y\":36},{\"lvl\":5,\"data\":1000013,\"x\":24,\"y\":12},{\"lvl\":5,\"data\":1000011,\"x\":27,\"y\":21},{\"lvl\":0,\"data\":1000015,\"x\":11,\"y\":32},{\"lvl\":8,\"data\":1000002,\"x\":18,\"y\":5,\"res_timer\":120217},{\"lvl\":5,\"data\":1000000,\"x\":28,\"y\":7},{\"lvl\":9,\"data\":1000006,\"x\":34,\"y\":24},{\"lvl\":7,\"data\":1000010,\"x\":27,\"y\":36},{\"lvl\":6,\"data\":1000010,\"x\":15,\"y\":4},{\"lvl\":7,\"data\":1000010,\"x\":28,\"y\":36},{\"lvl\":7,\"data\":1000010,\"x\":28,\"y\":35},{\"lvl\":7,\"data\":1000010,\"x\":28,\"y\":34},{\"lvl\":7,\"data\":1000010,\"x\":28,\"y\":33},{\"lvl\":7,\"data\":1000010,\"x\":28,\"y\":32},{\"lvl\":7,\"data\":1000010,\"x\":28,\"y\":31},{\"lvl\":7,\"data\":1000010,\"x\":28,\"y\":30},{\"lvl\":7,\"data\":1000010,\"x\":28,\"y\":29},{\"lvl\":7,\"data\":1000010,\"x\":28,\"y\":28},{\"lvl\":6,\"data\":1000010,\"x\":14,\"y\":4},{\"lvl\":6,\"data\":1000010,\"x\":14,\"y\":5},{\"lvl\":6,\"data\":1000010,\"x\":14,\"y\":6},{\"lvl\":6,\"data\":1000010,\"x\":14,\"y\":7},{\"lvl\":6,\"data\":1000010,\"x\":14,\"y\":8},{\"lvl\":6,\"data\":1000010,\"x\":14,\"y\":9},{\"lvl\":6,\"data\":1000010,\"x\":14,\"y\":10},{\"lvl\":7,\"data\":1000010,\"x\":28,\"y\":27},{\"lvl\":6,\"data\":1000010,\"x\":14,\"y\":12},{\"lvl\":6,\"data\":1000010,\"x\":14,\"y\":11},{\"lvl\":6,\"data\":1000010,\"x\":15,\"y\":13},{\"lvl\":6,\"data\":1000010,\"x\":14,\"y\":13},{\"lvl\":6,\"data\":1000010,\"x\":13,\"y\":13},{\"lvl\":6,\"data\":1000010,\"x\":12,\"y\":13},{\"lvl\":7,\"data\":1000010,\"x\":29,\"y\":27},{\"lvl\":7,\"data\":1000010,\"x\":17,\"y\":25},{\"lvl\":7,\"data\":1000010,\"x\":16,\"y\":25},{\"lvl\":7,\"data\":1000010,\"x\":16,\"y\":24},{\"lvl\":7,\"data\":1000010,\"x\":16,\"y\":23},{\"lvl\":6,\"data\":1000010,\"x\":11,\"y\":13},{\"lvl\":7,\"data\":1000010,\"x\":16,\"y\":22},{\"lvl\":7,\"data\":1000010,\"x\":16,\"y\":21},{\"lvl\":7,\"data\":1000010,\"x\":16,\"y\":20},{\"lvl\":7,\"data\":1000010,\"x\":16,\"y\":19},{\"lvl\":6,\"data\":1000010,\"x\":10,\"y\":13},{\"lvl\":7,\"data\":1000010,\"x\":16,\"y\":18},{\"lvl\":7,\"data\":1000010,\"x\":16,\"y\":17},{\"lvl\":7,\"data\":1000010,\"x\":16,\"y\":16},{\"lvl\":7,\"data\":1000010,\"x\":16,\"y\":15},{\"lvl\":7,\"data\":1000010,\"x\":17,\"y\":15},{\"lvl\":7,\"data\":1000010,\"x\":18,\"y\":15},{\"lvl\":7,\"data\":1000010,\"x\":19,\"y\":15},{\"lvl\":7,\"data\":1000010,\"x\":20,\"y\":15},{\"lvl\":7,\"data\":1000010,\"x\":21,\"y\":15},{\"lvl\":6,\"data\":1000010,\"x\":5,\"y\":24},{\"lvl\":7,\"data\":1000010,\"x\":22,\"y\":15},{\"lvl\":7,\"data\":1000010,\"x\":23,\"y\":15},{\"lvl\":7,\"data\":1000010,\"x\":24,\"y\":15},{\"lvl\":7,\"data\":1000010,\"x\":25,\"y\":15},{\"lvl\":9,\"data\":1000008,\"x\":30,\"y\":24},{\"lvl\":9,\"data\":1000008,\"x\":25,\"y\":29},{\"lvl\":9,\"data\":1000009,\"x\":17,\"y\":22},{\"lvl\":5,\"data\":1000013,\"x\":30,\"y\":16},{\"lvl\":2,\"data\":1000023,\"x\":10,\"y\":20,\"res_timer\":40689},{\"lvl\":5,\"data\":1000012,\"x\":30,\"y\":20},{\"lvl\":3,\"data\":1000024,\"x\":17,\"y\":16},{\"lvl\":3,\"data\":1000026,\"x\":6,\"y\":20},{\"lvl\":0,\"data\":1000022,\"x\":17,\"y\":19},{\"lvl\":2,\"data\":1000028,\"x\":24,\"y\":23},{\"lvl\":0,\"data\":1000015,\"x\":7,\"y\":11},{\"lvl\":10,\"data\":1000005,\"x\":23,\"y\":26},{\"lvl\":10,\"data\":1000003,\"x\":17,\"y\":26},{\"lvl\":6,\"data\":1000010,\"x\":5,\"y\":23},{\"lvl\":6,\"data\":1000010,\"x\":5,\"y\":22},{\"lvl\":6,\"data\":1000010,\"x\":5,\"y\":21},{\"lvl\":6,\"data\":1000010,\"x\":5,\"y\":20},{\"lvl\":6,\"data\":1000010,\"x\":5,\"y\":19},{\"lvl\":6,\"data\":1000010,\"x\":5,\"y\":18},{\"lvl\":6,\"data\":1000010,\"x\":5,\"y\":17},{\"lvl\":7,\"data\":1000010,\"x\":26,\"y\":15},{\"lvl\":7,\"data\":1000010,\"x\":26,\"y\":16},{\"lvl\":7,\"data\":1000010,\"x\":26,\"y\":17},{\"lvl\":7,\"data\":1000010,\"x\":26,\"y\":18},{\"lvl\":6,\"data\":1000010,\"x\":5,\"y\":16},{\"lvl\":6,\"data\":1000010,\"x\":5,\"y\":15},{\"lvl\":6,\"data\":1000010,\"x\":5,\"y\":14},{\"lvl\":6,\"data\":1000010,\"x\":5,\"y\":13},{\"lvl\":6,\"data\":1000010,\"x\":6,\"y\":13},{\"lvl\":6,\"data\":1000010,\"x\":7,\"y\":13},{\"lvl\":6,\"data\":1000010,\"x\":8,\"y\":13},{\"lvl\":6,\"data\":1000010,\"x\":9,\"y\":13},{\"lvl\":6,\"data\":1000010,\"x\":9,\"y\":14},{\"lvl\":6,\"data\":1000010,\"x\":9,\"y\":15},{\"lvl\":6,\"data\":1000010,\"x\":9,\"y\":16},{\"lvl\":6,\"data\":1000010,\"x\":9,\"y\":17},{\"lvl\":6,\"data\":1000010,\"x\":9,\"y\":18},{\"lvl\":6,\"data\":1000010,\"x\":9,\"y\":19},{\"lvl\":6,\"data\":1000010,\"x\":9,\"y\":20},{\"lvl\":6,\"data\":1000010,\"x\":9,\"y\":21},{\"lvl\":7,\"data\":1000010,\"x\":26,\"y\":19},{\"lvl\":7,\"data\":1000010,\"x\":26,\"y\":20},{\"lvl\":7,\"data\":1000010,\"x\":26,\"y\":21},{\"lvl\":7,\"data\":1000010,\"x\":26,\"y\":22},{\"lvl\":7,\"data\":1000010,\"x\":26,\"y\":23},{\"lvl\":7,\"data\":1000010,\"x\":26,\"y\":24},{\"lvl\":6,\"data\":1000010,\"x\":9,\"y\":22},{\"lvl\":7,\"data\":1000010,\"x\":26,\"y\":25},{\"lvl\":6,\"data\":1000010,\"x\":9,\"y\":23},{\"lvl\":6,\"data\":1000010,\"x\":9,\"y\":25},{\"lvl\":6,\"data\":1000010,\"x\":9,\"y\":24},{\"lvl\":6,\"data\":1000010,\"x\":13,\"y\":19},{\"lvl\":6,\"data\":1000010,\"x\":13,\"y\":18},{\"lvl\":6,\"data\":1000010,\"x\":19,\"y\":12},{\"lvl\":6,\"data\":1000010,\"x\":20,\"y\":12},{\"lvl\":7,\"data\":1000010,\"x\":25,\"y\":25},{\"lvl\":7,\"data\":1000010,\"x\":24,\"y\":25},{\"lvl\":7,\"data\":1000010,\"x\":23,\"y\":25},{\"lvl\":7,\"data\":1000010,\"x\":22,\"y\":25},{\"lvl\":7,\"data\":1000010,\"x\":21,\"y\":25},{\"lvl\":7,\"data\":1000010,\"x\":20,\"y\":25},{\"lvl\":7,\"data\":1000010,\"x\":19,\"y\":25},{\"lvl\":7,\"data\":1000010,\"x\":18,\"y\":25},{\"lvl\":9,\"data\":1000009,\"x\":23,\"y\":16},{\"lvl\":5,\"data\":1000013,\"x\":18,\"y\":29},{\"lvl\":5,\"data\":1000012,\"x\":21,\"y\":29},{\"lvl\":5,\"data\":1000011,\"x\":20,\"y\":26},{\"lvl\":2,\"data\":1000023,\"x\":20,\"y\":9,\"res_timer\":40691},{\"lvl\":3,\"data\":1000026,\"x\":6,\"y\":23},{\"lvl\":1,\"data\":1000029,\"x\":6,\"y\":14}],\"obstacles\":[],\"last_news_seen\":155,\"last_league_rank\":13,\"newShopBuildings\":[4,0,6,3,6,3,4,1,5,5,225,3,3,4,1,5,0,0,0,3,1,0,1,2,1,0,2,0,1,1],\"newShopDecos\":[1,4,0,1,1,4,4,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}","warVillage": "{\"newShopTraps\":[6,6,3,0,0,4,2,0,2],\"cooldowns\":[],\"last_league_shuffle\":1,\"decos\":[{\"data\":18000031,\"x\":2,\"y\":36},{\"data\":18000011,\"x\":4,\"y\":36},{\"data\":18000027,\"x\":6,\"y\":38},{\"data\":18000012,\"x\":6,\"y\":40},{\"data\":18000033,\"x\":6,\"y\":36}],\"edit_mode_shown\":true,\"buildings\":[{\"lvl\":7,\"data\":1000001,\"x\":20,\"y\":20},{\"lvl\":8,\"data\":1000004,\"x\":11,\"y\":34,\"res_timer\":0},{\"lvl\":5,\"data\":1000000,\"x\":10,\"y\":28},{\"lvl\":0,\"data\":1000015,\"x\":8,\"y\":30},{\"lvl\":3,\"data\":1000014,\"x\":25,\"y\":21},{\"lvl\":9,\"data\":1000008,\"x\":24,\"y\":29},{\"lvl\":0,\"data\":1000015,\"x\":37,\"y\":16},{\"lvl\":8,\"data\":1000002,\"x\":34,\"y\":13,\"res_timer\":120625},{\"lvl\":10,\"data\":1000003,\"x\":12,\"y\":24},{\"lvl\":10,\"data\":1000005,\"x\":16,\"y\":27},{\"lvl\":9,\"data\":1000006,\"x\":11,\"y\":5},{\"lvl\":9,\"data\":1000008,\"x\":18,\"y\":33},{\"lvl\":9,\"data\":1000009,\"x\":20,\"y\":25},{\"lvl\":6,\"data\":1000010,\"x\":30,\"y\":24},{\"lvl\":6,\"data\":1000010,\"x\":31,\"y\":24},{\"lvl\":6,\"data\":1000010,\"x\":32,\"y\":24},{\"lvl\":6,\"data\":1000010,\"x\":32,\"y\":23},{\"lvl\":6,\"data\":1000010,\"x\":32,\"y\":22},{\"lvl\":6,\"data\":1000010,\"x\":32,\"y\":21},{\"lvl\":6,\"data\":1000010,\"x\":15,\"y\":28},{\"lvl\":6,\"data\":1000010,\"x\":15,\"y\":29},{\"lvl\":6,\"data\":1000010,\"x\":15,\"y\":30},{\"lvl\":6,\"data\":1000010,\"x\":15,\"y\":31},{\"lvl\":6,\"data\":1000010,\"x\":15,\"y\":32},{\"lvl\":6,\"data\":1000010,\"x\":15,\"y\":33},{\"lvl\":6,\"data\":1000010,\"x\":15,\"y\":34},{\"lvl\":6,\"data\":1000010,\"x\":15,\"y\":35},{\"lvl\":6,\"data\":1000010,\"x\":16,\"y\":35},{\"lvl\":6,\"data\":1000010,\"x\":16,\"y\":36},{\"lvl\":6,\"data\":1000010,\"x\":17,\"y\":36},{\"lvl\":6,\"data\":1000010,\"x\":18,\"y\":36},{\"lvl\":6,\"data\":1000010,\"x\":19,\"y\":36},{\"lvl\":6,\"data\":1000010,\"x\":20,\"y\":36},{\"lvl\":6,\"data\":1000010,\"x\":21,\"y\":36},{\"lvl\":6,\"data\":1000010,\"x\":22,\"y\":36},{\"lvl\":6,\"data\":1000010,\"x\":23,\"y\":36},{\"lvl\":6,\"data\":1000010,\"x\":24,\"y\":36},{\"lvl\":6,\"data\":1000010,\"x\":25,\"y\":36},{\"lvl\":7,\"data\":1000010,\"x\":7,\"y\":21},{\"lvl\":7,\"data\":1000010,\"x\":7,\"y\":20},{\"lvl\":7,\"data\":1000010,\"x\":7,\"y\":19},{\"lvl\":7,\"data\":1000010,\"x\":7,\"y\":18},{\"lvl\":6,\"data\":1000010,\"x\":26,\"y\":36},{\"lvl\":6,\"data\":1000010,\"x\":26,\"y\":35},{\"lvl\":6,\"data\":1000010,\"x\":27,\"y\":35},{\"lvl\":6,\"data\":1000010,\"x\":27,\"y\":34},{\"lvl\":6,\"data\":1000010,\"x\":27,\"y\":33},{\"lvl\":6,\"data\":1000010,\"x\":27,\"y\":32},{\"lvl\":7,\"data\":1000010,\"x\":27,\"y\":31},{\"lvl\":7,\"data\":1000010,\"x\":27,\"y\":30},{\"lvl\":7,\"data\":1000010,\"x\":7,\"y\":17},{\"lvl\":7,\"data\":1000010,\"x\":27,\"y\":29},{\"lvl\":7,\"data\":1000010,\"x\":23,\"y\":29},{\"lvl\":7,\"data\":1000010,\"x\":23,\"y\":30},{\"lvl\":7,\"data\":1000010,\"x\":23,\"y\":31},{\"lvl\":6,\"data\":1000010,\"x\":23,\"y\":32},{\"lvl\":6,\"data\":1000010,\"x\":22,\"y\":32},{\"lvl\":6,\"data\":1000010,\"x\":21,\"y\":32},{\"lvl\":6,\"data\":1000010,\"x\":20,\"y\":32},{\"lvl\":6,\"data\":1000010,\"x\":19,\"y\":32},{\"lvl\":6,\"data\":1000010,\"x\":19,\"y\":29},{\"lvl\":6,\"data\":1000010,\"x\":19,\"y\":31},{\"lvl\":6,\"data\":1000010,\"x\":19,\"y\":30},{\"lvl\":5,\"data\":1000000,\"x\":11,\"y\":10},{\"lvl\":5,\"data\":1000013,\"x\":20,\"y\":29},{\"lvl\":5,\"data\":1000007,\"x\":7,\"y\":6},{\"lvl\":10,\"data\":1000005,\"x\":17,\"y\":12},{\"lvl\":10,\"data\":1000003,\"x\":27,\"y\":25},{\"lvl\":9,\"data\":1000009,\"x\":16,\"y\":20},{\"lvl\":6,\"data\":1000010,\"x\":19,\"y\":26},{\"lvl\":6,\"data\":1000010,\"x\":19,\"y\":27},{\"lvl\":7,\"data\":1000010,\"x\":7,\"y\":16},{\"lvl\":7,\"data\":1000010,\"x\":8,\"y\":16},{\"lvl\":7,\"data\":1000010,\"x\":8,\"y\":15},{\"lvl\":7,\"data\":1000010,\"x\":9,\"y\":15},{\"lvl\":6,\"data\":1000010,\"x\":19,\"y\":28},{\"lvl\":6,\"data\":1000010,\"x\":20,\"y\":28},{\"lvl\":6,\"data\":1000010,\"x\":21,\"y\":28},{\"lvl\":6,\"data\":1000010,\"x\":22,\"y\":28},{\"lvl\":6,\"data\":1000010,\"x\":23,\"y\":28},{\"lvl\":6,\"data\":1000010,\"x\":24,\"y\":28},{\"lvl\":6,\"data\":1000010,\"x\":25,\"y\":28},{\"lvl\":6,\"data\":1000010,\"x\":26,\"y\":28},{\"lvl\":6,\"data\":1000010,\"x\":27,\"y\":28},{\"lvl\":6,\"data\":1000010,\"x\":28,\"y\":28},{\"lvl\":6,\"data\":1000010,\"x\":29,\"y\":28},{\"lvl\":6,\"data\":1000010,\"x\":30,\"y\":28},{\"lvl\":6,\"data\":1000010,\"x\":31,\"y\":28},{\"lvl\":6,\"data\":1000010,\"x\":32,\"y\":28},{\"lvl\":6,\"data\":1000010,\"x\":33,\"y\":28},{\"lvl\":6,\"data\":1000010,\"x\":34,\"y\":28},{\"lvl\":7,\"data\":1000010,\"x\":10,\"y\":15},{\"lvl\":7,\"data\":1000010,\"x\":11,\"y\":15},{\"lvl\":7,\"data\":1000010,\"x\":12,\"y\":15},{\"lvl\":8,\"data\":1000002,\"x\":5,\"y\":27,\"res_timer\":120624},{\"lvl\":9,\"data\":1000006,\"x\":5,\"y\":12},{\"lvl\":9,\"data\":1000006,\"x\":4,\"y\":17},{\"lvl\":8,\"data\":1000002,\"x\":23,\"y\":37,\"res_timer\":120160},{\"lvl\":8,\"data\":1000002,\"x\":35,\"y\":29,\"res_timer\":120716},{\"lvl\":8,\"data\":1000004,\"x\":18,\"y\":37,\"res_timer\":0},{\"lvl\":8,\"data\":1000004,\"x\":28,\"y\":36,\"res_timer\":0},{\"lvl\":8,\"data\":1000004,\"x\":24,\"y\":32,\"res_timer\":120216},{\"lvl\":5,\"data\":1000000,\"x\":29,\"y\":11},{\"lvl\":7,\"data\":1000010,\"x\":13,\"y\":15},{\"lvl\":6,\"data\":1000010,\"x\":35,\"y\":28},{\"lvl\":6,\"data\":1000010,\"x\":35,\"y\":27},{\"lvl\":6,\"data\":1000010,\"x\":36,\"y\":27},{\"lvl\":6,\"data\":1000010,\"x\":36,\"y\":26},{\"lvl\":6,\"data\":1000010,\"x\":36,\"y\":25},{\"lvl\":6,\"data\":1000010,\"x\":36,\"y\":24},{\"lvl\":6,\"data\":1000010,\"x\":36,\"y\":23},{\"lvl\":6,\"data\":1000010,\"x\":36,\"y\":22},{\"lvl\":6,\"data\":1000010,\"x\":36,\"y\":21},{\"lvl\":6,\"data\":1000010,\"x\":36,\"y\":20},{\"lvl\":6,\"data\":1000010,\"x\":36,\"y\":19},{\"lvl\":7,\"data\":1000010,\"x\":14,\"y\":15},{\"lvl\":6,\"data\":1000010,\"x\":36,\"y\":18},{\"lvl\":6,\"data\":1000010,\"x\":36,\"y\":17},{\"lvl\":6,\"data\":1000010,\"x\":36,\"y\":16},{\"lvl\":6,\"data\":1000010,\"x\":35,\"y\":16},{\"lvl\":6,\"data\":1000010,\"x\":34,\"y\":16},{\"lvl\":6,\"data\":1000010,\"x\":30,\"y\":16},{\"lvl\":7,\"data\":1000010,\"x\":15,\"y\":15},{\"lvl\":7,\"data\":1000010,\"x\":16,\"y\":15},{\"lvl\":7,\"data\":1000010,\"x\":16,\"y\":14},{\"lvl\":6,\"data\":1000010,\"x\":31,\"y\":16},{\"lvl\":6,\"data\":1000010,\"x\":32,\"y\":16},{\"lvl\":6,\"data\":1000010,\"x\":29,\"y\":16},{\"lvl\":9,\"data\":1000008,\"x\":22,\"y\":8},{\"lvl\":9,\"data\":1000009,\"x\":10,\"y\":16},{\"lvl\":5,\"data\":1000012,\"x\":24,\"y\":25},{\"lvl\":8,\"data\":1000002,\"x\":21,\"y\":33,\"res_timer\":120218},{\"lvl\":8,\"data\":1000004,\"x\":8,\"y\":22,\"res_timer\":120687},{\"lvl\":5,\"data\":1000011,\"x\":16,\"y\":30},{\"lvl\":2,\"data\":1000020,\"x\":37,\"y\":19},{\"lvl\":8,\"data\":1000004,\"x\":32,\"y\":25,\"res_timer\":120626},{\"lvl\":6,\"data\":1000010,\"x\":32,\"y\":17},{\"lvl\":6,\"data\":1000010,\"x\":33,\"y\":16},{\"lvl\":7,\"data\":1000010,\"x\":16,\"y\":13},{\"lvl\":7,\"data\":1000010,\"x\":16,\"y\":12},{\"lvl\":7,\"data\":1000010,\"x\":16,\"y\":11},{\"lvl\":7,\"data\":1000010,\"x\":16,\"y\":10},{\"lvl\":6,\"data\":1000010,\"x\":32,\"y\":20},{\"lvl\":6,\"data\":1000010,\"x\":31,\"y\":20},{\"lvl\":6,\"data\":1000010,\"x\":30,\"y\":20},{\"lvl\":6,\"data\":1000010,\"x\":29,\"y\":20},{\"lvl\":6,\"data\":1000010,\"x\":20,\"y\":14},{\"lvl\":6,\"data\":1000010,\"x\":20,\"y\":13},{\"lvl\":6,\"data\":1000010,\"x\":20,\"y\":12},{\"lvl\":6,\"data\":1000010,\"x\":20,\"y\":11},{\"lvl\":6,\"data\":1000010,\"x\":21,\"y\":11},{\"lvl\":6,\"data\":1000010,\"x\":22,\"y\":11},{\"lvl\":6,\"data\":1000010,\"x\":23,\"y\":11},{\"lvl\":7,\"data\":1000010,\"x\":16,\"y\":9},{\"lvl\":7,\"data\":1000010,\"x\":16,\"y\":8},{\"lvl\":7,\"data\":1000010,\"x\":17,\"y\":8},{\"lvl\":6,\"data\":1000010,\"x\":24,\"y\":11},{\"lvl\":6,\"data\":1000010,\"x\":24,\"y\":12},{\"lvl\":7,\"data\":1000010,\"x\":17,\"y\":7},{\"lvl\":7,\"data\":1000010,\"x\":18,\"y\":7},{\"lvl\":7,\"data\":1000010,\"x\":19,\"y\":7},{\"lvl\":5,\"data\":1000013,\"x\":29,\"y\":21},{\"lvl\":5,\"data\":1000011,\"x\":17,\"y\":9},{\"lvl\":0,\"data\":1000015,\"x\":8,\"y\":11},{\"lvl\":8,\"data\":1000002,\"x\":33,\"y\":20,\"res_timer\":120217},{\"lvl\":5,\"data\":1000000,\"x\":28,\"y\":29},{\"lvl\":9,\"data\":1000006,\"x\":4,\"y\":22},{\"lvl\":7,\"data\":1000010,\"x\":20,\"y\":7},{\"lvl\":6,\"data\":1000010,\"x\":24,\"y\":13},{\"lvl\":7,\"data\":1000010,\"x\":21,\"y\":7},{\"lvl\":7,\"data\":1000010,\"x\":22,\"y\":7},{\"lvl\":7,\"data\":1000010,\"x\":23,\"y\":7},{\"lvl\":7,\"data\":1000010,\"x\":24,\"y\":7},{\"lvl\":7,\"data\":1000010,\"x\":25,\"y\":7},{\"lvl\":7,\"data\":1000010,\"x\":26,\"y\":7},{\"lvl\":7,\"data\":1000010,\"x\":27,\"y\":7},{\"lvl\":7,\"data\":1000010,\"x\":27,\"y\":8},{\"lvl\":7,\"data\":1000010,\"x\":28,\"y\":8},{\"lvl\":6,\"data\":1000010,\"x\":24,\"y\":14},{\"lvl\":6,\"data\":1000010,\"x\":24,\"y\":18},{\"lvl\":6,\"data\":1000010,\"x\":24,\"y\":17},{\"lvl\":6,\"data\":1000010,\"x\":24,\"y\":16},{\"lvl\":6,\"data\":1000010,\"x\":24,\"y\":15},{\"lvl\":6,\"data\":1000010,\"x\":23,\"y\":15},{\"lvl\":6,\"data\":1000010,\"x\":22,\"y\":15},{\"lvl\":7,\"data\":1000010,\"x\":28,\"y\":9},{\"lvl\":6,\"data\":1000010,\"x\":21,\"y\":15},{\"lvl\":6,\"data\":1000010,\"x\":20,\"y\":15},{\"lvl\":6,\"data\":1000010,\"x\":19,\"y\":15},{\"lvl\":6,\"data\":1000010,\"x\":18,\"y\":15},{\"lvl\":6,\"data\":1000010,\"x\":17,\"y\":15},{\"lvl\":6,\"data\":1000010,\"x\":11,\"y\":24},{\"lvl\":7,\"data\":1000010,\"x\":28,\"y\":10},{\"lvl\":7,\"data\":1000010,\"x\":28,\"y\":11},{\"lvl\":7,\"data\":1000010,\"x\":28,\"y\":12},{\"lvl\":7,\"data\":1000010,\"x\":28,\"y\":13},{\"lvl\":7,\"data\":1000010,\"x\":28,\"y\":14},{\"lvl\":6,\"data\":1000010,\"x\":15,\"y\":24},{\"lvl\":7,\"data\":1000010,\"x\":28,\"y\":15},{\"lvl\":7,\"data\":1000010,\"x\":28,\"y\":16},{\"lvl\":7,\"data\":1000010,\"x\":28,\"y\":17},{\"lvl\":7,\"data\":1000010,\"x\":28,\"y\":18},{\"lvl\":6,\"data\":1000010,\"x\":15,\"y\":25},{\"lvl\":7,\"data\":1000010,\"x\":28,\"y\":19},{\"lvl\":7,\"data\":1000010,\"x\":28,\"y\":20},{\"lvl\":7,\"data\":1000010,\"x\":28,\"y\":21},{\"lvl\":7,\"data\":1000010,\"x\":28,\"y\":22},{\"lvl\":7,\"data\":1000010,\"x\":28,\"y\":23},{\"lvl\":7,\"data\":1000010,\"x\":28,\"y\":24},{\"lvl\":7,\"data\":1000010,\"x\":27,\"y\":24},{\"lvl\":7,\"data\":1000010,\"x\":26,\"y\":24},{\"lvl\":7,\"data\":1000010,\"x\":25,\"y\":24},{\"lvl\":6,\"data\":1000010,\"x\":15,\"y\":26},{\"lvl\":7,\"data\":1000010,\"x\":21,\"y\":19},{\"lvl\":7,\"data\":1000010,\"x\":22,\"y\":19},{\"lvl\":7,\"data\":1000010,\"x\":23,\"y\":19},{\"lvl\":7,\"data\":1000010,\"x\":24,\"y\":19},{\"lvl\":9,\"data\":1000008,\"x\":33,\"y\":17},{\"lvl\":9,\"data\":1000008,\"x\":8,\"y\":19},{\"lvl\":9,\"data\":1000009,\"x\":21,\"y\":16},{\"lvl\":5,\"data\":1000013,\"x\":12,\"y\":20},{\"lvl\":2,\"data\":1000023,\"x\":37,\"y\":24,\"res_timer\":40689},{\"lvl\":5,\"data\":1000012,\"x\":16,\"y\":24},{\"lvl\":3,\"data\":1000024,\"x\":25,\"y\":18},{\"lvl\":3,\"data\":1000026,\"x\":20,\"y\":4},{\"lvl\":0,\"data\":1000022,\"x\":25,\"y\":15},{\"lvl\":2,\"data\":1000028,\"x\":16,\"y\":17},{\"lvl\":0,\"data\":1000015,\"x\":16,\"y\":37},{\"lvl\":10,\"data\":1000005,\"x\":25,\"y\":12},{\"lvl\":10,\"data\":1000003,\"x\":13,\"y\":16},{\"lvl\":6,\"data\":1000010,\"x\":15,\"y\":27},{\"lvl\":6,\"data\":1000010,\"x\":14,\"y\":27},{\"lvl\":6,\"data\":1000010,\"x\":13,\"y\":27},{\"lvl\":6,\"data\":1000010,\"x\":12,\"y\":27},{\"lvl\":6,\"data\":1000010,\"x\":11,\"y\":27},{\"lvl\":6,\"data\":1000010,\"x\":10,\"y\":27},{\"lvl\":6,\"data\":1000010,\"x\":9,\"y\":27},{\"lvl\":7,\"data\":1000010,\"x\":24,\"y\":20},{\"lvl\":7,\"data\":1000010,\"x\":24,\"y\":21},{\"lvl\":7,\"data\":1000010,\"x\":24,\"y\":22},{\"lvl\":7,\"data\":1000010,\"x\":24,\"y\":23},{\"lvl\":6,\"data\":1000010,\"x\":8,\"y\":27},{\"lvl\":6,\"data\":1000010,\"x\":8,\"y\":26},{\"lvl\":6,\"data\":1000010,\"x\":7,\"y\":26},{\"lvl\":6,\"data\":1000010,\"x\":15,\"y\":20},{\"lvl\":6,\"data\":1000010,\"x\":15,\"y\":21},{\"lvl\":6,\"data\":1000010,\"x\":29,\"y\":24},{\"lvl\":6,\"data\":1000010,\"x\":15,\"y\":23},{\"lvl\":6,\"data\":1000010,\"x\":14,\"y\":23},{\"lvl\":6,\"data\":1000010,\"x\":13,\"y\":23},{\"lvl\":6,\"data\":1000010,\"x\":12,\"y\":23},{\"lvl\":6,\"data\":1000010,\"x\":11,\"y\":23},{\"lvl\":6,\"data\":1000010,\"x\":15,\"y\":22},{\"lvl\":6,\"data\":1000010,\"x\":17,\"y\":19},{\"lvl\":6,\"data\":1000010,\"x\":16,\"y\":19},{\"lvl\":6,\"data\":1000010,\"x\":15,\"y\":19},{\"lvl\":6,\"data\":1000010,\"x\":14,\"y\":19},{\"lvl\":7,\"data\":1000010,\"x\":24,\"y\":24},{\"lvl\":7,\"data\":1000010,\"x\":23,\"y\":24},{\"lvl\":7,\"data\":1000010,\"x\":22,\"y\":24},{\"lvl\":7,\"data\":1000010,\"x\":21,\"y\":24},{\"lvl\":7,\"data\":1000010,\"x\":20,\"y\":24},{\"lvl\":7,\"data\":1000010,\"x\":13,\"y\":19},{\"lvl\":6,\"data\":1000010,\"x\":12,\"y\":19},{\"lvl\":7,\"data\":1000010,\"x\":11,\"y\":19},{\"lvl\":6,\"data\":1000010,\"x\":11,\"y\":20},{\"lvl\":6,\"data\":1000010,\"x\":11,\"y\":21},{\"lvl\":6,\"data\":1000010,\"x\":11,\"y\":22},{\"lvl\":6,\"data\":1000010,\"x\":7,\"y\":25},{\"lvl\":6,\"data\":1000010,\"x\":7,\"y\":24},{\"lvl\":6,\"data\":1000010,\"x\":7,\"y\":23},{\"lvl\":6,\"data\":1000010,\"x\":7,\"y\":22},{\"lvl\":7,\"data\":1000010,\"x\":19,\"y\":25},{\"lvl\":7,\"data\":1000010,\"x\":19,\"y\":24},{\"lvl\":7,\"data\":1000010,\"x\":19,\"y\":23},{\"lvl\":7,\"data\":1000010,\"x\":19,\"y\":22},{\"lvl\":7,\"data\":1000010,\"x\":19,\"y\":21},{\"lvl\":7,\"data\":1000010,\"x\":19,\"y\":20},{\"lvl\":7,\"data\":1000010,\"x\":19,\"y\":19},{\"lvl\":7,\"data\":1000010,\"x\":20,\"y\":19},{\"lvl\":9,\"data\":1000009,\"x\":29,\"y\":17},{\"lvl\":5,\"data\":1000013,\"x\":21,\"y\":12},{\"lvl\":5,\"data\":1000012,\"x\":18,\"y\":16},{\"lvl\":5,\"data\":1000011,\"x\":25,\"y\":9},{\"lvl\":2,\"data\":1000023,\"x\":29,\"y\":7,\"res_timer\":40691},{\"lvl\":3,\"data\":1000026,\"x\":15,\"y\":4},{\"lvl\":1,\"data\":1000029,\"x\":25,\"y\":4}],\"obstacles\":[],\"last_news_seen\":155,\"last_league_rank\":13,\"newShopBuildings\":[4,0,6,3,6,3,4,1,5,5,225,3,3,4,1,5,0,0,0,3,1,0,1,2,1,0,2,0,1,1],\"newShopDecos\":[1,4,0,1,1,4,4,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}"}';
$data = json_decode($str,1);
$village = json_decode($data['villageJson'],1);
$randomVar = $village['buildings'];
print_r($randomVar);
You should use json_decode() to turn the string into an object.
PHP: json_decode - Manual

Beginner to creating and reading JSON objects

Using http://objectmix.com/javascript/389546-reading-json-object-jquery.html as a starting point, I have been reading lots about JSON. Unfortunately I am a total beginner and can't get my head around the basics of creating JSON objects.
I have created a PHP page called getContact.php
<?php
"Contact": {
"ID" : "1",
"Name" : "Brett Samuel"
}
?>
And a javascript file with the following code:
$.getJSON('getContacts.php', function(data) {
var obj = (new Function("return " + data))();
alert(data.Contact.Name)
});
This page http://msdn.microsoft.com/en-us/library/bb299886.aspx suggests I have the basic approach correct. Can anyone tell me why this does not work? Absolutely nothing happens.
Thanks in advance.
Your PHP file contains JSON, which is not valid PHP, and will therefore error.
If you're working with PHP the easiest way to build JSON is to first prepare your data as an array (associative or indexed, as required) then simply convert it via json_encode(). (You can also decode JSON, with the corresponding json_decode().
[EDIT - in response to comment, just have a look at the PHP docs for json_encode() - it's very self explanatory. You take an array, pass it to json_encode(), and you get a JSON string.
$arr = array('one', 'two', 'three');
echo json_encode($arr); //JSON string
JSON is not a programming language, and it's certainly not executable as PHP. It's just a file format. If you want your web server to serve up a static JSON file, just drop it in the file system as filename.json, without any <?php tags. (Of course, as with HTML, you can also make it a .php file and just not have any PHP in it, other than something to set the Content-Type since the file suffix won't do it automatically. But that's wasteful.)
If you want to dynamically generate some JSON with PHP, then you have to write PHP code to print it out, e.g.:
<?= json_encode( array(
'Contact' => array('ID' => 1, 'Name' => 'Brett Samuel' )
) ); ?>
Also, note that a JSON document has to be a complete object; yours requires another set of curly braces around the whole thing (as output by the above snippet).
you need to use json_encode and json_decode
refer this json php manual

JSON Encode/decode doesn't work as it should

I am preparing and sending a JSON string from my PHP file to my Javascript function like this:
$json = array();
$json['slice'] = false;
$json['G500'] = false;
$json['KG1'] = false;
$encoded = json_encode($json);
die($encoded);
However, in my JS function, if I do this, it is unable to decode the JSON object:
var d = req.responseText;
var jsonObject = eval(d);
The only way, I can get it to eval the JSON object is by adding parentheses manually
jsonObject = eval("(" + d + ")");
I have the same problem going in reverse as well. Sending a JSON object to PHP and trying to decode it there fails. I believe I would need to remove the parentheses in my PHP script before attempting to decode.
Why is this happening? Is there something I can do to work around this incompatibility?
EDIT:
PHP to JS is now working if I use JSON.parse. I'm still having trouble the other way around.
This is how I'm sending the data to the PHP:
var JSONstring =
{
"Product": document.getElementById('item').value,
"Size": document.getElementById('size').value,
"Quantity": document.getElementById('quantity').value
};
url = "maintainOrder.php?json=" + JSON.stringify(JSONstring);
req.open("GET", url, true);
However, the PHP script is unable to decode it.
$newItem = json_decode($_GET['json']);
array_push($_SESSION['order'],$newItem);
Your Javascript
eval has an issue with leading { characters, because of an ambiguity with block scope.
Using the parentheses to force the input to be parsed as an expression is a solution, but you should avoid eval entirely and use a proper JSON decoding function.
Your PHP
We'd need to see the data that you send to your PHP script to know why it won't parse. In general, as long as JSONLint accepts your JSON, so will PHP's json_decode. So give that a go.
For the php to javascript issue refer to the Tomalak Geret'kal answer.
For the javascript to php maybe I have the solution:
If you want an associative array in php then you have to pass assoc parameter as true into json_decode (default to false)
Example:
$array = json_decode($jsonString, true);
I was bitten a couple of times by this: by default json_decode try to create an object if it receive a javascript object (it make perfect sense if you think of) and you have to force it to render an associative array if you need this behaviour
I think you need to do some string processing, all you need to do is echo and see the exact format of your JSON string and make sure it conforms to the standard format, then use string processing both on the server and client sides to achieve the desired effect
Are you sure php is not adding slashes to the json text?, try saving the json text in a file in the server side to verify

Problem with php and json

Could some one please help me out on this I have the following json string
string(1223) "YAHOO.Finance.SymbolSuggest.ssCallback({"ResultSet":{"Query":"google","Result":[{"symbol":"GOOG","name": "Google Inc.","exch": "NMS","type": "S","exchDisp":"NASDAQ","typeDisp":"Equity"},{"symbol":"GOOG.MX","name": "GOOGLE-A","exch": "MEX","type": "S","exchDisp":"Mexico","typeDisp":"Equity"},{"symbol":"GGQ1.F","name": "GOOGLE-A","exch": "FRA","type": "S","exchDisp":"Frankfurt","typeDisp":"Equity"}]}})"
But I cannot seem to get anywhere with it. Basically I want to just loop out the the results which are
[{"symbol":"GOOG","name": "Google Inc.","exch": "NMS","type": "S","exchDisp":"NASDAQ","typeDisp":"Equity"},{"symbol":"GOOG.MX","name": "GOOGLE-A","exch": "MEX","type": "S","exchDisp":"Mexico","typeDisp":"Equity"},{"symbol":"GGQ1.F","name": "GOOGLE-A","exch": "FRA","type": "S","exchDisp":"Frankfurt","typeDisp":"Equity"}]
Sorry my question is how can I loop or even print the first result for example
{"symbol":"GOOG","name": "Google Inc.","exch": "NMS","type": "S","exchDisp":"NASDAQ","typeDisp":"Equity"}
Your string is not JSON, it is JSON-in-Script. Notice the fragment that says:
YAHOO.Finance.SymbolSuggest.ssCallback(...)
When a browser receives the above mentioned script (actually a javascript code) it will call the YAHOO.Finance.SymbolSuggest.ssCallback function, passing the JSON data as the argument.
You did not mention if you want to access the JASON data on the server side or client? It its server side (PHP) then you can use regular expressions or string replacement functions to extract the portion you like. The you can use json_decode() function to convert the resulting string into an associative array.
Edit ----
A quick and dirty hack for converting JSONP to JSON:
<?php
$text = 'YAHOO.Finance.SymbolSuggest.ssCallback({"ResultSet":{"Query":"google","Result":[{"symbol":"GOOG","name": "Google Inc.","exch": "NMS","type": "S","exchDisp":"NASDAQ","typeDisp":"Equity"},{"symbol":"GOOG.MX","name": "GOOGLE-A","exch": "MEX","type": "S","exchDisp":"Mexico","typeDisp":"Equity"},{"symbol":"GGQ1.F","name": "GOOGLE-A","exch": "FRA","type": "S","exchDisp":"Frankfurt","typeDisp":"Equity"}]}})';
# //CONVERT JSONP to JSON\\
$text = preg_replace('/.+?({.+}).+/', '$1', $text);
# \\CONVERT JSONP to JSON//
$data = json_decode($text);
var_dump($data);
var_dump($data->ResultSet->Result[0]);
var_dump($data->ResultSet->Result[0]->symbol);
var_dump($data->ResultSet->Result[0]->name);
# etc etc
?>
Your result is not just a JSON string, it's a JSON string prepended by a call to a JSON function. This is quite certainly a JSONP call.
You must write the YAHOO.Finance.SymbolSuggest.ssCallback(data) javascript function and get the Json there. Check the JSONP query, you should be able to alter the name of this backreference function if you want another name, it's usually on of the parameter in the GET query.
Now you are maybe calling it directly from PHP and you are not in js envirronment. so you must write something in your PHP code to remove the YAHOO.Finance.SymbolSuggest.ssCallback( part and the ) at the end before parsing it as JSON data..

Categories