Skip to main content

JSON Module

The JSON module allows parsing and generating data in JSON format (JavaScript Object Notation) in JARU. It's very useful for communication with REST APIs and storing configurations.

JARU JSON module screenshot for parsing, creating, and serializing structured data

Usage

use JSON

Functions

In Development

Detailed documentation for this module is being updated. The following operations are available:

  • Parsing JSON strings to JARU objects
  • Serializing JARU objects to JSON strings
  • JSON format validation

Basic Example

use JSON

// Parse a JSON string
var jsonStr = '{"name": "John", "age": 25}'
var obj = JSON.parse(jsonStr)
println("Name: ", obj.name)
println("Age: ", obj.age)

// Convert object to JSON
var person = {name: "Mary", age: 30}
var str = JSON.stringify(person)
println(str)