Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

Overview

This example shows how to use the org.json.me parser provided by json.org to parse and browse a JSON file.

The contents of the JSON file is taken from an example available from http://www.json.org/example.html

The example then iterates over all the menuitem elements available in the popup menu and print their contents.

Requirements

This example has been tested on:

Usage

Follow MICROEJ SDK 6 Installation Guide to setup the SDK.

By default, the sample will use the NXP i.MX RT1170 VEE Port 3.0.0. The sample retrieves the VEE Port as a module.

Refer to the Select a VEE Port documentation to use another VEE Port in your project.

Run on Simulator

Run the following command in your IDE (or click the Play button next to the line below when opening this README in IntelliJ IDEA):

./gradlew :json:runOnSimulator

Alternative ways to run in simulation are described in the Run on Simulator documentation.

Run on Device

Complete the Getting Started for NXP i.MX RT1170 Evaluation Kit to make sure your environment is fully setup.

If you are using another VEE Port, make sure to properly setup the VEE Port environment before going further. Refer to the dedicated VEE Port README or Getting Started for more information.

Run the following command in your IDE (or click the Play button next to the line below when opening this README in IntelliJ IDEA):

./gradlew :json:runOnDevice

Alternative ways to run on device are described in the Run on Device documentation.

Expected Behavior

The following traces should be observed in the console:

The JSONObject named "menu" is:
{"value":"File","id":"file","popup":{"menuitem":[{"value":"New","onclick":"CreateNewDoc()"},{"value":"Open","onclick":"OpenDoc()"},{"value":"Close","onclick":"CloseDoc()"}]}}

The JSONObject named "popup" in "menu" is:
{"menuitem":[{"value":"New","onclick":"CreateNewDoc()"},{"value":"Open","onclick":"OpenDoc()"},{"value":"Close","onclick":"CloseDoc()"}]}

The menuitem content of popup is:
[{"value":"New","onclick":"CreateNewDoc()"},{"value":"Open","onclick":"OpenDoc()"},{"value":"Close","onclick":"CloseDoc()"}]

The value of "Unknown key" is:
Default value

The new JSONArray is:
{"window":true,"menu":[{"value":"File","id":"file","popup":{"menuitem":[{"value":"New","onclick":"CreateNewDoc()"},{"value":"Open","onclick":"OpenDoc()"},{"value":"Close","onclick":"CloseDoc()"},{"value":"Save","onClick":"SaveDoc()"}]}},{"id":"file2"},{"id":"file3"}]}

Dependencies

The dependencies defined in build.gradle.kts are configured in libs.versions.toml.

All dependencies are retrieved transitively by Gradle.

Source

N/A

Restrictions

None.


Markdown
Copyright 2019-2025 MicroEJ Corp. All rights reserved.
Use of this source code is governed by a BSD-style license that can be found with this software.