2017년 7월 6일 목요일

[JSON] How to form JSON ?


Is there any way to form JSON? I can not access Value part of Key value pair of a JSON
Everything I tried assigned to Key, not value
How to do that?

{
"xAccel" : "1234",
"yAccel" : "2345"
}

Haven't found anything in discussion

--
That is not helping at all. Please please please read post before answering.

--
@ Anupam ... you do not need to be rude.   " Thank you very much for trying but that did not answer my very specific unclear question" would have been polite.   Perhaps you should be using Android Studio?

--
I am not being rude. I have posted in previous post too. Please read before answer. I am not asking what JSON is. I am asking how to create JSON using MIT App Invent only. NOT Android Studio.Please again read my query. The question is clear if you read through the post content rather than just Subject of post. JSON Forming with AppInvent.not any other programming language, not any other tool. Solely by AppInvent . Because I am working on AppInvent. Sorry if I sound rude to you, but that is what my query is.accelerometer 

This is JSON Response : { "{\"xAccel\": \"3.75411": "" }
where as It should be in key value pair, everything here goes to key, not in value. 
Hope now it should be clear.

--
ok, you found out meanwhile how to put together a JSON format using the join block
now what prevents you to add the YAccel and ZAccel key and value as further sockets in the join block?

--
also use "Do it" to debug your blocks and to see, how the JSON format looks like in the end
see also tip 4
Here is an example of creating JSON in App Inventor, using variables as values, from this tutorial (Step 5) 


There might be an error in your formatting. The spaces, speech marks etc have to be exact. Your Response { "{\"xAccel\": \"3.75411": "" } does not look correctWhere are you getting this response from? As Taifun said, use the DoIt to see what the string actually is. It should be {"key": "value"}, like this

   Hope that helps.

--
Here's how I encoded a pair list ...
(See attachments.)
It's my first attempt working with JSON.
It seems to satisfy the JSON decoding block of the Web component.



--

댓글 없음:

댓글 쓰기