Error converting Json string to array of objects PHP - 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.

Related

php: json_decode containing HTML fails to decode

I need to use a customer's API for loading JSON which only contains something like:
{"html" : "foo"}
The API is being used from other services so I'm pretty sure it's valid.
However, when trying to decode it using json_decode i'm always getting an empty string which means it's not valid. I found out i need to "fix" the JSON-String by replacing:
$json = str_replace("\\>", "\\\\>", $json); // \> = invalid json
It works mainly on each request but not on certain others but it's very tricky to debug and i can't imagine that replacing is the proper method.
How would i do it the easy way for converting the json string into a valid one?
thanks
Ok i could find out what's wrong:
The HTML contains backslashes in the closing tags, for example <br\>
You need to replace them like this:
$json = str_replace("\\>", "\\\\>", $json);
and json_decode will work

php json_decode error quoted object property name expected

I try to create a script that decoding a simple JSON string in PHP and I get the following error:
quoted object property name expected
The string I try to decode is the following :
{"values":[{"url":"http://www.google.com","matches":"http|www|google|com"},{"url":"http://www.yahoo.com","matches":"http|www|yahoo|com"}]}
and the code I use to decoded is the following:
json_decode( $json_string );
I also have try to validate my json string in some online json validators, and the string seems to be fine.
Can someone please help me ?
Do you think the problem exists because of the double quotes ?
Update #1
Definetelly was a debuging issue. I place my experience here just to help other devs may come accross the same issue in the feature:
The problem was that my variable that came with the json string was html encoded so instead of the following string :
{"values":[{"url":"http://www.google.com","matches":"http|www|google|com"},{"url":"http://www.yahoo.com","matches":"http|www|yahoo|com"}]}
my variable came with the following string inside :
{"values":[{"url":"http://www.google.com","matches":"http|www|google|com"},{"url":"http://www.yahoo.com","matches":"http|www|yahoo|com"}]}
The mistake by my side was that I used the print_r method instead of the var_dump . This had as a result to print out the &quot as " in my page .
The json string is valid, and it works. You can add true for the second parameter of json_decode, and you get back an array.
Try the following:
$json_string = '{"values":[{"url":"http://www.google.com","matches":"http|www|google|com"},{"url":"http://www.yahoo.com","matches":"http|www|yahoo|com"}]}';
var_dump(json_decode($json_string, true));
It works for me.

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

Do i need to apply htmlspecialchars / htmlentites on json array?

I wanted to ask that in a php script of mine which I am accessing through an ajax request, I am returning json data ( converted from an array ) as such
echo json_encode($row_array);
I get this data in jquery and display it in a form. Do i need to apply htmlspecialchars / htmlentites before returning the data?
Is do then whats the correct way to do it? The following code gives me an error:
echo htmlentities(json_encode($row_array));
Thanking you
Imran
Do not apply htmlentities in this way. You should walk the array before json encoding it and escape each element, then json encode the array of safe-to-display values. In your usage json is just a transport layer for the array. You are not displaying the json array, just the element data. Don't escape transport layers--it could make the json string invalid.
Context is important.
You don't need to escape the data at all on the server side if it's going into a form input's value if you are using jQuery's val() function to populate it.
Example: http://jsfiddle.net/Y6TWv/1/
var data = '<strong>STRONG TEXT</strong>';
$('input').val(data); // output is escaped
$('p').text(data); // output is escaped
$('p').html(data); ​ // output is not escaped
In addition, if you were to escape the data, don't do it like this:
// escapes the entire json string, not good - quotes will be broken
echo htmlentities(json_encode($row_array));
You would have to escape each item of $row_array first before json encoding it, either with array_map after the array is built, or as you're building the array.
In general, you should prefer htmlspecialchars over htmlentities, but it's not likely you need either one.
I just had a problem with single quotes in a JSON array. Chrome doesn't like single quotes in a JSON response returned via ajax. I escaped each value with htmlspecialchars(, ENT_QUOTES).
$theoptions['MemberList'] = array();
while($row = mssql_fetch_assoc($result)) {
$memberelement = array(
'Display'=> htmlspecialchars($row['FullName'], ENT_QUOTES),
'Value' => $row['ID']);
$theoptions['MemberList'][] = $memberelement;
}
header('Content-Type: application/json');
echo json_encode($theoptions);

PHP json_encode not returning valid json

I am running a Debian box with PHP v5.2.17. I am trying to get around the cross-domain issue with an XML file and am using this got to fetch any xml and return json:
<?php
header('content-type: application/json; charset=utf-8');
if( strlen($_GET["feed"]) >= 13 ) {
$xml = file_get_contents(urldecode($_GET["feed"]));
if($xml) {
$data = #simplexml_load_string($xml, "SimpleXMLElement", LIBXML_NOCDATA);
$json = json_encode($data);
echo isset($_GET["callback"]) ? "{$_GET[’callback’]}($json)" : $json;
}
}
?>
The problem is, its not returning valid json to jquery.. The start character is "(" and the end is ")" where jquery wants "[" as the start and "]" as the end. I've taken the output and used several online validation tools to check it..
Is there a way I can change these characters prior to sending back or pass json_encode options?
You could change json_encode($data) to json_encode(array($data)) if it expects an array (like you're saying):
$json = json_encode(array($data));
EDIT: Also, I believe the SimpleXml call will result in a bunch of SimpleXmlElements, perhaps json_encode then thinks it should be objects, instead of arrays? Perhaps casting to an array will yield the correct results.
You cannot json_encode() SimpleXMLElements (that's the type that is returned by simplexml_load_string(). You have to convert the data from the XML file into some native PHP type (most likely an array).
SORRY that's wrong. json_encode() can in fact encode SimpleXMLElements (at least on my PHP version 5.3.4). So if your client-side code expects an array you must wrap your $data in an array:
$json = json_encode(array($data));
We can use json_encode() function most probably on array. so you first take XML content into PHP array and then apply json_encode().I think this will solve your problem..
It seems that you are sending an empty callback parameter or something, but the callback parameter in jQuery must look exactly like this: callback=?

Categories