This Kodular extension is designed to simplify JSON parsing within your Kodular projects. It provides a set of blocks that enable you to easily work with JSON data.
- Parse JSON strings into Kodular variables.
- Access JSON values by key.
- Traverse JSON arrays and objects with ease.
To use this extension in your Kodular project, follow these steps:
- Download the latest release from the Releases section of this GitHub repository.
- In your Kodular project, go to the "Extensions" section.
- Click on the "Import Extension" button.
- Upload the downloaded extension file (
jsonparser.kodular.aix
). - The extension will be added to your project.
To parse a JSON string, use the ParseJSON
block:
JSON Parser Extension
ParseJSON [JSONString]
JSONString
should contain the JSON data as a string.
Once you have parsed the JSON, you can access its values using the GetIntegerValue
block:
JSON Parser Extension
GetIntegerValue [attributeName] and store in [destinationVariable]
attributeName
is the key of the JSON value you want to retrieve.destinationVariable
is where the retrieved value will be stored.
JSON Parser Extension
GetStringValue [attributeName] and store in [destinationVariable]
attributeName
is the key of the JSON value you want to retrieve.destinationVariable
is where the retrieved value will be stored.
JSON Parser Extension
GetDoubleValue [attributeName] and store in [destinationVariable]
attributeName
is the key of the JSON value you want to retrieve.destinationVariable
is where the retrieved value will be stored.
JSON Parser Extension
OpenJSONObject [JSONString]
JSONString
is the key of the JSON object you want to traverse.
JSON Parser Extension
OpenJSONArray [JSONString]
JSONString
is the key of the JSON array you want to traverse.
JSON Parser Extension
OpenObjectInArrayByIndex [index]
index
is the index of the JSON object you want to traverse.
JSON Parser Extension
OpenArrayInArrayByIndex [index]
index
is the index of the JSON array you want to traverse.
Here's a simple example of parsing JSON and accessing its values:
When Screen1.Initialize
JSON Parser Extension
ParseJSON "{\"name\":\"John\",\"age\":30,\"height\":\"1.78\"}"
JSON Parser Extension
GetStringValue "name" and store in global Name
JSON Parser Extension
GetIntegerValue "age" and store in global Age
JSON Parser Extension
GetDoubleValue "height" and store in global Height
In this example, we parse a JSON string, access its values by key, and store them in global variables for later use.
Learn how to create Kodular extensions
If you would like to contribute to this project or report issues, please open an issue or submit a pull request.
This extension is released under the MIT License. Please review the License file for more details.