Skip to content

pwall567/json-simple

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

json-simple

Build Status License: MIT Maven Central

Simple JSON Parser and Formatter

Background

This library is a set of simple JSON parsing and formatting functions, for use in those cases where the use of a more heavyweight library can not be justified.

Quick Start

To parse a string of JSON to a simple structure consisting solely of standard Java classes and interfaces:

        Object structure = JSONSimple.parse(json);

The structure will consist of:

  • a Map (for JSON objects)
  • a List (for JSON arrays)
  • a String (for JSON strings)
  • an Integer (for JSON integers up to 32 bits)
  • a Long (for JSON integers 32-64 bits)
  • a BigDecimal (for other JSON numbers, including floating point)
  • a Boolean (for JSON booleans)
  • null (for the JSON null values using the null keyword)

To format an object like the one returned by a parse() operation:

        String formatted = JSONSimple.format(structure);

See the JavaDoc for more information, including changing the indentation size and line terminator.

Dependency Specification

The latest version of the library is 1.9, and it may be obtained from the Maven Central repository.

Maven

    <dependency>
      <groupId>net.pwall.json</groupId>
      <artifactId>json-simple</artifactId>
      <version>1.9</version>
    </dependency>

Gradle

    implementation 'net.pwall.json:json-simple:1.9'

Gradle (kts)

    implementation("net.pwall.json:json-simple:1.9")

Peter Wall

2024-02-18

About

Simple JSON Parser and Formatter

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Languages