I’m new to working with Json strings and am not really sure if the JsonTextDecode block on the AppInventor works correctly, because the input and the result seems the same to me…
So by the way, what exactly is correct? encode or serialize and decode or deserialize??
Here is the (supposedly) encoded Json string which I receive back from my database using php (did this with a little help from a colleague):
[{“pid”:”1″,”name”:”Jan”,”age”:”2″,”gender”:”male”}]
And here is the (supposedly) deserialized Json string which I receive on my Android emulator when using the Blocks editor tool:
[{“pid”:”1″,”name”:”Jan”,”age”:”2″,”gender”:”male”}]
So what’s the difference?
And how should it be handled?
Can I extract the value of “name” which is “Jan” from the string and only display that?
I’ll stop before I start asking too many questions, my main concern is to understand Json strings better.
Hope someone can help.
Thanks.
There must be a function in any language to handle json.
In PHP you can decode JSON string into array or object using
json_decodefunction, Thus you can easily access the values.