Hello friends:
With this extension we can get the elements of a Json easily by writing their path.
I have tested it with App Inventor and now with Kodular on an Android 9.
This extension is based on this library:
- Blocks.
- Set a Json string and a path (see example). Get object or array.
- Set a Json string, Show Json in pretty format.
- Convert Json string to Xml string and Xml string to Json string.
- Example.
- To carry out the tests we will use the author’s example.
{
“store”: {
“book”: [
{
“category”: “reference”,
“author”: “Nigel Rees”,
“title”: “Sayings of the Century”,
“price”: 8.95
},
{
“category”: “fiction”,
“author”: “Evelyn Waugh”,
“title”: “Sword of Honour”,
“price”: 12.99
},
{
“category”: “fiction”,
“author”: “Herman Melville”,
“title”: “Moby D ck”,
“isbn”: “0-553-21311-3”,
“price”: 8.99
},
{
“category”: “fiction”,
“author”: “J. R. R. Tolkien”,
“title”: “The Lord of the Rings”,
“isbn”: “0-395-19395-8”,
“price”: 22.99
}
],
“bicycle”: {
“color”: “red”,
“price”: 19.95
}
},
“expensive”: 10
}
- App example.
Decode_JsonPath.aia (568.9 KB)
- Screenshot.
- The extension com.KIO4_DecoJson.aix is here:
App Inventor. Extensión. Decodifica Json. JsonPath. Convertir de Json a Xml y de Xml a Json.