Code Monkey home page Code Monkey logo

api4json's Introduction

API4JSON

Version 3.0.1

This library is modeled after the IBM JSON4J APIs. It provides serialization using sorted keys. The goal is to provide a drop-in alternative to the com.ibm.json4j-x.x.x.jar file for people wanting the same API structure but needing to install the jar file in cloud functions or to use with command line utilities using JSON. One minor improvement over the JSON4J library is that numbers are always treated as Long or Double values for consistency when working with parsed JSON content. Though the put API will accept other Numeric values, they are stored as Long or Double and retrieved as such. In json4j, if you stored an Integer and used the get API, it would return an Integer. But, if you serialized and then parsed the data, it would change to returning a Long. The same was true in JSON4J for a Float becoming a Double after parsing serialized content.

I have attempted to perform conversions for Unicode characters and preserve solidus escape sequences.

For people familiar with the IBM json4j library, simply use this jar and change the import statements from com.ibm.json.java to com.api.json, and everything should work as before.

Development Environment

You'll need to set up the following build environment:

  • Java JDK 11 (we've used the IBM Semuru JDK from this download site)
  • Install Maven from this download site.
  • Developers, please use Eclipse version 2024-06 or later.

Please contact Nathaniel Mills ([email protected]) with questions.

api4json's People

Contributors

dependabot[bot] avatar matteobaccan avatar wnm3 avatar wnmills3 avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

api4json's Issues

Add JUnit Tests

Test various parsing capabilities for JSONObject and JSONArray from text in test files.

Keys with escapable characters should be escaped

When a key containing an escapable character like a quote is output, that key should be escaped.

  JSONObject test = new JSONObject();
  test.put("key with \"quoted string\"", "some value");
  String testVal = "{\"key with \\\"quoted string\\\"\":\"some value\"}";
  System.out.println(test);

Above should output:
{"key with "quoted string"":"some value"}
not
{"key with "quoted string"":"some value"}

Update version and republish to maven.

Change license to Apache 2.0 from LGPL and release new version 3.0.0

  • [ x ] Create a new version 3.0.0 of the software (saving the current version 2.0.1 as LGPL)
  • [ x ] Update all headers with the Apache 2.0 License verbiage
  • [ x ] Update the LICENSE.TXT file with the Apache 2.0 License
  • [ x ] Add to the README.md that version 3.0.0 is now under the Apache 2.0 License and version 2.0.1 remains under LGPL.
  • [ x ] Check in all code and release the jar file to Maven Central as version 3.0.0

Also, change the ESCAPE_SOLIDUS from true to false to make the JSON more friendly for URLs to remain as is.

Fix unicode bug

The comparison for unicode prefixed with three zeros should test for 0x0f not 0x09

Release 2.0.3

Upgraded Eclipse to version 2022-12
Fixed the line offset reported in exceptions
Removed extraneous System.out.println

Disallow puting an object to itself

x.put("x",x); results in a stack overflow in toString()
added test for value in put to throw an IllegalArgumentException if it is the same object as this.

Also updated JAVA_HOME variable in launcher, and set version to 1.8 for javadoc build in pom.xml

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.