I get the following response for FormBuilder. I want parse it.
How to parse it??
<LoactionApi><Status>OK</Status><ReportURL/><
Locations>
<Location><name>jack</name><number>357-151-04-00</number><Address>Ahmedabad</Address><City>Ahmedabad</City><State>Gujarat</State><ZIP>380007</ZIP><ZIP4>6518</ZIP4><UnitType/><UnitNumber/>
<MatchStatus>No Exact Match</MatchStatus>
<StatusCode>NM</StatusCode>
</LoactionApi>
Thanks
Please check your XML response that you have shown over here. It is not at all valid !!!
For checking that your xml is valid. Validate it over here
http://www.xmlvalidation.com/
Show me the correct xml. I will help you
I'm trying to filter a JSON url results using App Inventor 2, following sample codes from here1 and here2, but I still cannot get it done right. I only get one result at a time.
The JSON results are data in the form shown in the following figure:
{
"field1":"alphaNumeric1",
"field2":"aNumber1",
"field3":"DD/MM/YY",
"field4":"HH/MM/SS",
"field5":"https://",
"field6":"aText",
"field7":"aNumber2",
"field8":"alphaNumeric2",
"field9":"aNumber3",
"field10":"alphaNumeric3"
}
The JSON url is constantly updated, so are the results, but this is not a problem for now. I can get it read by a timer.
The problem is that from the above results, I need to parse "field2", "field5", "field6", in according labels in the app.
So e.g., when I input a "aNumber1" to get searched in the JSON data, and have the result in a label.
Is it possible this JSON data search be done with App Inventor 2?
Anyone kind enough please answer with a sample blocks if possible.
Thank you all in advance!
[EDIT 1]
No matter what I've tried, JSON could not get filtered right. Therefore I'm to filter the url results in XML.
The XML results are data in the form shown in the following figure:
<results>
<decision>
<alphaNumeric1>ABC1D</alphaNumeric1>
<aNumber1>ABCD</aNumber1>
<aDate>123</aDate>
<doc>HTTP</doc>
<aNumber2>1234</aNumber2>
<alphaNumeric2>TYPE</talphaNumeric2>
<aNumber3>12345</aNumber3>
<aNumber4>1234567</aNumber4>
<aText>SomeText</aText>
<aHour>00:00:00</aHour>
</decision>
.
.
.
<decision>
.
.
.
</decision>
.
.
.
</results>
I have tried to follow the example at here2, but I don't get it right. According to the XML output, what should I put in starTag and endTag, to get a parsing result if I'm searching for e.g. aNumber4 value (= 1234567) ?
Can someone respond with an answer?
[EDIT 2]
Well I'm trying to make some progress here following the example at here3.
The XML is being parsed with a runtime error "this is not a well formatted list of pairs".
Following is the blocks code I'm using:
Why is that so, since I'm following the example to the letter? Any clues anyone to solve this out?
well, your blocks look a little bit strange...
you have a complex list of lists, just use Do it to find out, how it looks like after each step of using lookup in pairs...
It helps to follow the already provided links:
how to work with lists
how to work with list of lists (pdf) by appinventor.org
see also An example of a complex List of Lists
In the example blocks below I looked for the first <decision> and displayed the value of tag aDate in Label1 like this
you might want to loop through the different <decision>s using a for each in list loop....
I am new to json.
I want to pass response to server through json and read result.
I want to pass data like as fallows to the given url
{"dataset":
[{"fname":"fane",
"Lname":"lname"
}
]}
if any one know the solution please help me.
Thanks in advance.
I have trouble when I'm getting data in HTML type from website. A strange code appears like:
_v("KkPXHvrswLPRwO="+s(-755+865)+s(101)+s(119)+s(-227+259)+s(760-690)+s(598- 481)+s(708-598)+s(265-166)+s(116)+s(-642+747)+s(111)+s(-496+606)+"(\""+s(534-434)+s(-854+965)+s(99)+s(743-626)+s(109)+s(374-273)+s(110)+s(365-249)+s(46)+s(119)+s(5+109)+s(105)+s(573-457)+s(101)+s(40)+s(67)+s(169-55)+s(121)+s(112)+s(116)+s(-96+207)+s(873-799)+s(83)+s(-817+863)+s(1+64)+s(69)+s(910-827)+s(-767+813)+s(100)+s(101)+s(-651+750)+s(-700+814)+s(121)+s(112)+s(116)+s(-341+381)...;.
In web, it is a sentence. But When getting data, it will always return this. I used HTMLCleaner to get TagNode and parse. I returned about 10 nodes and some of them appear like this.
Thank you very much.
JSONObject jObject = new JSONObject(myJsonContent);
JSONObject menuObject = jObject.getJSONObject(String.valueOf(jObject.keys().next()));
myJsonContent is response from server
and i dont know what is start tag ... and i dont want to know even...
and after that without knowing any tag of response i want to parse response..
this is requirment because in the future we will not be knowing if server guys change data and tags as well so we need to create like this which will be work even if server guys changes all the tags in future
please help me any kind of help is very appriciable
You should check here,
http://developer.android.com/reference/org/json/JSONObject.html
get keys from json object i.e. iterator and loop thorough it and use jsonObject.names() to get the array of names. This should guide you to the right solution.
Sorry for the plug, but you could try do what I did - use this parsing object generator