Giter Site home page Giter Site logo

deftu-archive / json-plus Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 2.0 363 KB

A lightweight JSON library made for the JVM.

License: GNU Lesser General Public License v3.0

Java 97.28% Kotlin 2.72%
java json-library json json-parser java-json java-json-library java-json-api java-library

json-plus's Introduction

JSON+

forthebadge forthebadge forthebadge forthebadge forthebadge forthebadge forthebadge

About

JSON+ is a JSON library to be used with the Java Virtual Machine.

json-plus's People

Contributors

danielcastelluccio avatar deftu avatar wyvest avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

json-plus's Issues

Fails to Deserialize

java.lang.ArrayIndexOutOfBoundsException: Index 0 out of bounds for length 0
	at xyz.matthewtgm.json.serialization.JsonDeserializer.createClassInstance(JsonDeserializer.java:68)
	at xyz.matthewtgm.json.serialization.JsonDeserializer.deserialize(JsonDeserializer.java:31)
	at dev.fxe.TGMJsonBenchmark.deserialize(TGMJsonBenchmark.java:19)
	at dev.fxe.DataGenerator.main(DataGenerator.java:39)
public static void deserialize() throws FileNotFoundException {
	BufferedReader bufferedReader = new BufferedReader(new FileReader("people.json"));
	String data = bufferedReader.lines().collect(Collectors.joining());
	Person[] people = JsonDeserializer.deserialize(data, Person[].class);
}


public class Person {

	String fullName;
	String firstName;
	String lastName;
	String address;
	int age;
	Book favouriteBook;

	public Person(String fullName, String firstName, String lastName, String address, int age, String author, String title) {
		this.fullName = fullName;
		this.firstName = firstName;
		this.lastName = lastName;
		this.address = address;
		this.age = age;
		this.favouriteBook = new Book(author, title);
	}
}

public class Book {

	String author;
	String title;

	public Book(String author, String tittle) {
		this.author = author;
		this.title = tittle;
	}
}

The file to deserialize

people.json

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.