0

for some reason I have a problem getting a JSON input into PHP. Basically, I am importing a variable from a url-encoded JSON, the bit of code I have problem with looks like this:

"nearest_area": [ 
                 { 
                   "country": [
                     {"value": "Czech Republic"}
                   ],   
                  "region": [ 
                     {"value": "Moravskoslezsky Kraj" }
                 ]         
               } 
             ]

When I import and JSON_decode it in PHP, I used the exact same way of getting the two variables. For country I used

data->nearest_area[0]->country[0]->value;

and I got Czech Republic, for the other one I used region instead of country, but for some reason instead of Moravskoslezsky Kraj, I am always getting just the first word - "Moravskoslezsky".

The only reason I could think of what could be causing the problem is encoding. In fact, in Czech, the actual name of the region ("kraj") is "Moravskoslezský". I used the UTF8 decoding procedure and indeed I am getting the proper "ý" at the end instead of "y", but then it just skips the rest....

Any ideas what could be wrong?

sandipon
  • 986
  • 1
  • 6
  • 19

1 Answers1

0

OK, sorry I have figured it out, there was a problem with encoding the actual url.