Download

- Stars (0)

0 Downloads

Version: 4.0

Last Updated: 20-09-2019 1:21

Share
DescriptionVersions
JSONTools Version 4.aix

https://thunkableblocks.blogspot.com/2017/07/jsontools-extension.html

JSONTools Extension

This is a Beta version of my JSON Tools extension for App Inventor, this extension makes it easier to work with JSON and get the information you need out of a JSON String. Many online services have API’s which output in JSON format and this extension will enable you to easily decipher the JSON format.

As mentioned this is a beta release as I have been busy lately, I still wanted to release this extension and make it available for people to play around with, however, as a beta release please note that the methods available in this extension are not finalised and may change in future releases.

× To learn more about JSON and the differences between a JSON Object and a JSON Array, check out my article: Understanding JSON and how it works.

Extension Usage

ParseJSON

The first block to start using this extension is the ParseJSON block, this block takes in JSON as a String and internally converts it into an Object. (Images and more documentation coming soon)

Methods

OpenObject

This method sets the current position to the specified object, e.g. If you called OpenObject(”Phone”), this would internally open the phone object so that you can retrieve the values inside.

NEW! Updated Documentation 2019

I hope this updated documentation is helpful in understanding how this extension works, this will be updated over time but please bear with me as I am still working through an overuse injury, I want to keep working on this blog but rest is very important for me to keep doing these things in the future 🙂

Example – Updated for Version 3+ 2019

The following example takes some sample JSON found online which contains fictitious company contacts and locations, you can tap next and previous buttons to browse through the different contacts and the company coordinates are shown in a Google Maps component.
Screenshot of the blocks used in the JSONToolsExample project

Download Here

× Note: this is a BETA version of this extension, the methods in this extension may change in future releases. Be sure to keep regular backups of your apps.
Download Version 4 JSONTools extension here: JSONTools.aix
Download the Updated JSONTools Example project here: JSONToolsExample.aia

Previous Builds:
Download Version 3 JSONTools extension here: JSONTools.aix
Download the JSONTools [BETA] extension here: JSONTools.aix

Version History

Version 4

GetStringInArrayByIndex using zero based indexes, this has been fixed to align with App Inventor Standards.
Added null value checking, preventing runtime errors if null values are used, this has been applied to the following methods:
  • OpenJSONObject
  • OpenJSONArray
  • OpenSubJSONArray
  • OpenSubJSONObject
  • GetStringValue
  • GetIntValue
  • GetBooleanValue
  • GetIntInArray
  • GetStringInArray
  • GetStringInArrayByIndex
  • OpenObjectInArrayByIndex
  • GetStringInSubJSONObject

Version 3

-Fixed OpenObjectInArrayByIndex to use non-zero indexes inline with App Inventor Standards
-Updated GetStringInSubJSONObject for all object types
-Updated Documentation
-Added GetIntInArray

Version 2

This version includes updated function descriptions, I’ve also implemented some internal variables to track the current location which will help add more useful functionality to this extension.
-OpenJSONObject
-OpenSubJSONObject
-GetIntValue
-GetBooleanValue
-GetStringInArrayByIndex
-OpenObjectInArrayByIndex
-SetCurrentPositionToRoot

Version 1

Initial release with the following functions;
-ParseJSON
-OpenJSONArray
-OpenSubJSONArray
-GetStringValue
-GetStringInArray
-GetStringInSubJSONArray
-GetStringInSubJSONObject
-GetCurrentArrayLength
Icons made by Madebyoliver from www.flaticon.com is licensed by CC 3.0 BY