Skip to content

SilasReinagel/LiteJavaJson

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LiteJavaJson

Build Status Code Quality License

The purpose of this project is to provide a very simple, no-fluff, single source file Java JSON Serializer/Deserializer.

This project is designed to offer maximum value with minimal setup/configuration/learning. It is designed to make Object mapping simple and painless.

The code is written in a procedural Utility-class style.

Usage

Add to Project

This library contains a single source file: Json.java

Copy-paste this file directly into your project.

Serialization

// Sample class
public class SimpleStringValueObject
{
    public String Value;
}

SimpleStringValueObject obj = new SimpleStringValueObject();
obj.Value = "Important Data Here";
String jsonString = Json.toJsonString(obj); 
// jsonString: { "Value": "Important Data Here" }

Deserialization

// Sample class
public class SimpleStringValueObject
{
    public String Value;
}

SimpleStringValueObject obj = Json.toObj(
	    SimpleStringValueObject.class, 
	    "{ \"Value\": \"Important Data Here\" }");

Deserialize Single Element Value (no Java object required)

double price = Json.getElementValue(
        Double.class, 
        "Price", 
		"{ \"Data1\": \"Something Useless\", \"Price\": 2.57 }");

Credits

Silas Reinagel

License

You may use this code in part or in full however you wish.
No credit or attachments are required.

About

Lightweight Single Source File Java JSON Library

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages