A reference implementation of a JSON package in Java.

Related tags

JSON JSON-java
Overview

JSON in Java [package org.json]

Maven Central

Click here if you just want the latest release jar file.

Overview

JSON is a light-weight language-independent data interchange format.

The JSON-Java package is a reference implementation that demonstrates how to parse JSON documents into Java objects and how to generate new JSON documents from the Java classes.

Project goals include:

  • Reliable and consistent results
  • Adherence to the JSON specification
  • Easy to build, use, and include in other projects
  • No external dependencies
  • Fast execution and low memory footprint
  • Maintain backward compatibility
  • Designed and tested to use on Java versions 1.6 - 1.11

The files in this package implement JSON encoders and decoders. The package can also convert between JSON and XML, HTTP headers, Cookies, and CDL.

The license includes this restriction: "The software shall be used for good, not evil." If your conscience cannot live with that, then choose a different package.

If you would like to contribute to this project

Bug fixes, code improvements, and unit test coverage changes are welcome! Because this project is currently in the maintenance phase, the kinds of changes that can be accepted are limited. For more information, please read the FAQ.

Build Instructions

The org.json package can be built from the command line, Maven, and Gradle. The unit tests can be executed from Maven, Gradle, or individually in an IDE e.g. Eclipse.

Building from the command line

Build the class files from the package root directory src/main/java

javac org\json\*.java

Create the jar file in the current directory

jar cf json-java.jar org/json/*.class

Compile a program that uses the jar (see example code below)

javac -cp .;json-java.jar Test.java 

Test file contents

import org.json.JSONObject;
public class Test {
    public static void main(String args[]){
       JSONObject jo = new JSONObject("{ \"abc\" : \"def\" }");
       System.out.println(jo.toString());
    }
}

Execute the Test file

java -cp .;json-java.jar Test

Expected output

{"abc":"def"}

Tools to build the package and execute the unit tests

Execute the test suite with Maven:

mvn clean test

Execute the test suite with Gradlew:

gradlew clean build test

Notes

Recent directory structure change

Due to a recent commit - #515 Merge tests and pom and code - the structure of the project has changed from a flat directory containing all of the Java files to a directory structure that includes unit tests and several tools used to build the project jar and run the unit tests. If you have difficulty using the new structure, please open an issue so we can work through it.

Implementation notes

Numeric types in this package comply with ECMA-404: The JSON Data Interchange Format and RFC 8259: The JavaScript Object Notation (JSON) Data Interchange Format. This package fully supports Integer, Long, and Double Java types. Partial support for BigInteger and BigDecimal values in JSONObject and JSONArray objects is provided in the form of get(), opt(), and put() API methods.

Although 1.6 compatibility is currently supported, it is not a project goal and might be removed in some future release.

In compliance with RFC8259 page 10 section 9, the parser is more lax with what is valid JSON then the Generator. For Example, the tab character (U+0009) is allowed when reading JSON Text strings, but when output by the Generator, the tab is properly converted to \t in the string. Other instances may occur where reading invalid JSON text does not cause an error to be generated. Malformed JSON Texts such as missing end " (quote) on strings or invalid number formats (1.2e6.3) will cause errors as such documents can not be read reliably.

Some notable exceptions that the JSON Parser in this library accepts are:

  • Unquoted keys { key: "value" }
  • Unquoted values { "key": value }
  • Unescaped literals like "tab" in string values { "key": "value with an unescaped tab" }
  • Numbers out of range for Double or Long are parsed as strings

Recent pull requests added a new method putAll on the JSONArray. The putAll method works similarly to other put methods in that it does not call JSONObject.wrap for items added. This can lead to inconsistent object representation in JSONArray structures.

For example, code like this will create a mixed JSONArray, some items wrapped, others not:

SomeBean[] myArr = new SomeBean[]{ new SomeBean(1), new SomeBean(2) };
// these will be wrapped
JSONArray jArr = new JSONArray(myArr);
// these will not be wrapped
jArr.putAll(new SomeBean[]{ new SomeBean(3), new SomeBean(4) });

For structure consistency, it would be recommended that the above code is changed to look like 1 of 2 ways.

Option 1:

SomeBean[] myArr = new SomeBean[]{ new SomeBean(1), new SomeBean(2) };
JSONArray jArr = new JSONArray();
// these will not be wrapped
jArr.putAll(myArr);
// these will not be wrapped
jArr.putAll(new SomeBean[]{ new SomeBean(3), new SomeBean(4) });
// our jArr is now consistent.

Option 2:

SomeBean[] myArr = new SomeBean[]{ new SomeBean(1), new SomeBean(2) };
// these will be wrapped
JSONArray jArr = new JSONArray(myArr);
// these will be wrapped
jArr.putAll(new JSONArray(new SomeBean[]{ new SomeBean(3), new SomeBean(4) }));
// our jArr is now consistent.

Unit Test Conventions

Test filenames should consist of the name of the module being tested, with the suffix "Test". For example, Cookie.java is tested by CookieTest.java.

The fundamental issues with JSON-Java testing are:

  • JSONObjects are unordered, making simple string comparison ineffective.
  • Comparisons via equals() is not currently supported. Neither JSONArray nor JSONObject override hashCode() or equals(), so comparison defaults to the Object equals(), which is not useful.
  • Access to the JSONArray and JSONObject internal containers for comparison is not currently available.

General issues with unit testing are:

  • Just writing tests to make coverage goals tends to result in poor tests.
  • Unit tests are a form of documentation - how a given method works is demonstrated by the test. So for a code reviewer or future developer looking at code a good test helps explain how a function is supposed to work according to the original author. This can be difficult if you are not the original developer.
  • It is difficult to evaluate unit tests in a vacuum. You also need to see the code being tested to understand if a test is good.
  • Without unit tests, it is hard to feel confident about the quality of the code, especially when fixing bugs or refactoring. Good tests prevent regressions and keep the intent of the code correct.
  • If you have unit test results along with pull requests, the reviewer has an easier time understanding your code and determining if it works as intended.

Files

JSONObject.java: The JSONObject can parse text from a String or a JSONTokener to produce a map-like object. The object provides methods for manipulating its contents, and for producing a JSON compliant object serialization.

JSONArray.java: The JSONArray can parse text from a String or a JSONTokener to produce a vector-like object. The object provides methods for manipulating its contents, and for producing a JSON compliant array serialization.

JSONTokener.java: The JSONTokener breaks a text into a sequence of individual tokens. It can be constructed from a String, Reader, or InputStream. It also can parse text from a String, Number, Boolean or null like "hello", 42, true, null to produce a simple json object.

JSONException.java: The JSONException is the standard exception type thrown by this package.

JSONPointer.java: Implementation of JSON Pointer (RFC 6901). Supports JSON Pointers both in the form of string representation and URI fragment representation.

JSONPropertyIgnore.java: Annotation class that can be used on Java Bean getter methods. When used on a bean method that would normally be serialized into a JSONObject, it overrides the getter-to-key-name logic and forces the property to be excluded from the resulting JSONObject.

JSONPropertyName.java: Annotation class that can be used on Java Bean getter methods. When used on a bean method that would normally be serialized into a JSONObject, it overrides the getter-to-key-name logic and uses the value of the annotation. The Bean processor will look through the class hierarchy. This means you can use the annotation on a base class or interface and the value of the annotation will be used even if the getter is overridden in a child class.

JSONString.java: The JSONString interface requires a toJSONString method, allowing an object to provide its own serialization.

JSONStringer.java: The JSONStringer provides a convenient facility for building JSON strings.

JSONWriter.java: The JSONWriter provides a convenient facility for building JSON text through a writer.

CDL.java: CDL provides support for converting between JSON and comma delimited lists.

Cookie.java: Cookie provides support for converting between JSON and cookies.

CookieList.java: CookieList provides support for converting between JSON and cookie lists.

HTTP.java: HTTP provides support for converting between JSON and HTTP headers.

HTTPTokener.java: HTTPTokener extends JSONTokener for parsing HTTP headers.

XML.java: XML provides support for converting between JSON and XML.

JSONML.java: JSONML provides support for converting between JSONML and XML.

XMLTokener.java: XMLTokener extends JSONTokener for parsing XML text.

Release history:

JSON-java releases can be found by searching the Maven repository for groupId "org.json" and artifactId "json". For example: https://search.maven.org/search?q=g:org.json%20AND%20a:json&core=gav

20210307    Recent commits and potentially breaking fix to JSONPointer

20201115    Recent commits and first release after project structure change

20200518    Recent commits and snapshot before project structure change

20190722    Recent commits

20180813    POM change to include Automatic-Module-Name (#431)

20180130    Recent commits

20171018    Checkpoint for recent commits.

20170516    Roll up recent commits.

20160810    Revert code that was breaking opt*() methods.

20160807    This release contains a bug in the JSONObject.opt*() and JSONArray.opt*() methods,
it is not recommended for use.
Java 1.6 compatability fixed, JSONArray.toList() and JSONObject.toMap(),
RFC4180 compatibility, JSONPointer, some exception fixes, optional XML type conversion.
Contains the latest code as of 7 Aug 2016

20160212    Java 1.6 compatibility, OSGi bundle. Contains the latest code as of 12 Feb 2016.

20151123    JSONObject and JSONArray initialization with generics. Contains the latest code as of 23 Nov 2015.

20150729    Checkpoint for Maven central repository release. Contains the latest code
as of 29 July 2015.
Comments
  • I would like to strictly name the module

    I would like to strictly name the module

    Hi There,

    I would like to update the pom and build to generate the module-info class file, and strictly name this module.

    Currently as an automatic module, you cannot perform a lot of JPMS functions, such as requires transitive, or evade the maven central deploy warning for unnamed modules.

    This is purely the raw code, could I get a zip of the build and send back a finished zip for perusal?

    opened by GedMarc 50
  • JSONObject and JSONArray initialization:

    JSONObject and JSONArray initialization:

    JSONObject(Map<String, ?> map) allows to initialize the JSONObject with a Map<String, String>

    JSONArray(Collection<?> collection) allows to initialize a JSONArray with a Collection<JSONObject>

    tests:

    public static void testJSONObjectWithStringMap(){
        Map<String, String> pairs = new HashMap<String, String>();
        pairs.put("one", "two");
        JSONObject j = new JSONObject(pairs);
        System.out.println(j);
        System.out.println(pairs);
        // what is wrong? --> since Map<String, String> cannot be mapped to Map<String, Object> 
        // the new JSONObject is being initialized with JSONObject(Object bean)
    }
    
    public static void testJSONArrayWithCollectionOfJSONObject(){
        List<JSONObject> jsonObjects = new ArrayList<JSONObject>();
        jsonObjects.add(new JSONObject().put("one", 1));
        jsonObjects.add(new JSONObject().put("two", 2));
        JSONArray jsonArray = new JSONArray(jsonObjects);
        System.out.println(jsonArray);
        // what is wrong? --> since Collection<Object> cannot be mapped to Collection<JSONObject>
        // the new JSONArray is being initialized with JSONArray(Object array)
    }
    
    opened by treyerl 44
  • XML.toJSONObject() crashes if CDATA is part of XML

    XML.toJSONObject() crashes if CDATA is part of XML

    in relation to: http://stackoverflow.com/questions/29283261/converting-xml-to-json-android

    I have the same issue too ans ask me, why "No virtual method end()Z in class Lorg/json/XMLTokener".

    Any ideas?

    opened by AppWerft 40
  • Use Appendable in place of Writer

    Use Appendable in place of Writer

    This change modifies JSONWriter to take an Appendable instead of a Writer as its constructor parameter. Appendable is an interface implemented by Writer, as well as classes such as StringBuilder.

    This refactor allows JSONStringer to use a StringBuilder directly, instead of a StringWriter.

    It also flows through to writeValue() in JSONObject. This in turn allows valueToString() to be simplified, simply delegating to writeValue() with StringBuilder as a parameter.

    I ran the test suite in JSON-Java-unit-test, which continues to pass. The code coverage varies in minor ways in JSONObject, JSONArray, and JSONWriter, due to the code reorganisation.

    opened by run2000 33
  • JSONObject.write(Writer writer, int indentFactor, int indent) Not public

    JSONObject.write(Writer writer, int indentFactor, int indent) Not public

    I'm not sure if this is me or the library but when I attempt to use JSONObject.write(Writer writer, int indentFactor, int indent) I get an error saying the method is not visible. If I open the .class file I can see the method as public. I am using the latest version from mavenCentral() using gradle. This is the class where I call the method:

    package json;
    
    import java.io.IOException;
    import java.io.PrintWriter;
    
    import org.json.JSONException;
    import org.json.JSONObject;
    
    public class JSONTest {
    
    	public void doStuff() {
    		
    		JSONObject obj = JSONUtils.getJSONObjectFromFile("json/obj.json");
    		
    		obj.put("Test", "test");
    		
    		String[] names = JSONObject.getNames(obj);
    		
    		if(names == null) {
    			System.out.println("JSON File had no names!");
    			return;
    		}
    		
    		for(String string : names) {
    			System.out.println(string + ": " + obj.get(string));
    		}
    		
    		try {
    			PrintWriter writer = new PrintWriter("src/main/resources/json/obj.json", "UTF-8");
    
                            //This is the error
    			obj.write(writer, 1, 0);
    			
    			writer.close();
    		} catch (IOException | JSONException e) {
    			e.printStackTrace();
    		}
    	}
    }
    
    opened by MitchellShapiro 26
  • Having issue while convertnig xml with single element to json array or vice versa

    Having issue while convertnig xml with single element to json array or vice versa

    Please have a look at - http://stackoverflow.com/questions/42900503/json-xml-converter-having-array-in-json-string/42901710#42901710

    http://heshans.blogspot.in/2014/01/java-library-to-convert-xml-to-json.html

    I am getting json array for below xml -

    <readResult><errors><code>400</code></errors><errors><code>402</code></errors></readResult>
    {"readResult":{"errors":[{"code":400},{"code":402}]}}
    

    but, we need similar behavior while converting json to xml and back again where json array is having single element i.e.

    input json - {"readResult": {"errors": [{"code": 400}]}}
    converted xml - <readResult><errors><code>400</code></errors></readResult>
    output json - {"readResult":{"errors":{"code":400}}}
    
    opened by rvashishth 25
  • Objects in collections needs to have override option from reflection-based variable detection

    Objects in collections needs to have override option from reflection-based variable detection

    adding a collection needs to have an option to use custom made JSONObjects for the elements in the collection instead of the default method and variable reflection based construction of the JSONObject because not everybody wants to push out all variables in the object into JSON to see for everybody.

    opened by KimvdLinde 24
  • JSONArray does not have constructor to allocate the specified initial capacity

    JSONArray does not have constructor to allocate the specified initial capacity

    The collection class like ArrayList has the constructor that accepts the number as an input to "Constructs an empty list with the specified initial capacity."
    The absence of this functionality in the JSONArray will not affect the performance of the smaller applications with a fairly limited number of iteration, but the huge applications that involve a large number of iterations will result in the performance trade-off because ArrayList grows or expands numerous times.

    opened by viveksacademia4git 23
  • NoSuchMethodError when converting xml in string to JSONObject

    NoSuchMethodError when converting xml in string to JSONObject

    java.lang.NoSuchMethodError: No static method stringToValue(Ljava/lang/String;)Ljava/lang/Object; in class Lorg/json/JSONObject; or its super classes (declaration of 'org.json.JSONObject' appears in /system/framework/core-libart.jar) at org.json.XML.parse(XML.java:241) at org.json.XML.toJSONObject(XML.java:331)

    opened by AvinashChowdary 23
  • Supported using custom map implementation for JSONObject

    Supported using custom map implementation for JSONObject

    Supported using custom map implementation for JSONObject, like a LinkedHashMap to keep the insertion order to the map fields.

    This is a more flexible implementation than https://github.com/stleary/JSON-java/pull/655.

    opened by lvca 22
  • Added type conversion support

    Added type conversion support

    The lib doesn't support type conversion for a specific value. I have added the feature to support type conversion for a specific tag. Example:

    //XML String <root><id1 xsi:type="java.lang.String">1234</id1><id2 xsi:type="java.lang.Integer">1234</id2></root>

    //Corresponding JSON String {"root":{"id2":1234,"id1":"1234"}}

    Approved 
    opened by kumar529 21
  • Add object-based versions of optInt & optFloat

    Add object-based versions of optInt & optFloat

    When reading a JSON file, I would like to return a null value if a key is not found. At present, optInt and optFloat only return primitives - so you can't set null as the default.

    It's a fairly simple change, to add in the following code to JSONObject:

        /**
         * Get the optional double (obj) value associated with an index. NaN is returned
         * if there is no value for the index, or if the value is not a number and
         * cannot be converted to a number.
         *
         * @param key
         *            A key string.
         * @return The value.
         */
        public Float optFloatObj(String key) {
            return this.optFloatObj(key, Float.NaN);
        }
    
        /**
         * Get the optional double (obj) value associated with an index. The defaultValue
         * is returned if there is no value for the index, or if the value is not a
         * number and cannot be converted to a number.
         *
         * @param key
         *            A key string.
         * @param defaultValue
         *            The default value.
         * @return The value.
         */
        public Float optFloatObj(String key, Float defaultValue) {
            Number val = this.optNumber(key);
            if (val == null) {
                return defaultValue;
            }
            final Float floatValue = val.floatValue();
            // if (Float.isNaN(floatValue) || Float.isInfinite(floatValue)) {
            // return defaultValue;
            // }
            return floatValue;
        }
    
        /**
         * Get an optional integer value associated with a key, or zero if there is no
         * such key or if the value is not a number. If the value is a string, an
         * attempt will be made to evaluate it as a number.
         *
         * @param key
         *            A key string.
         * @return An object which is the value.
         */
        public Integer optIntegerObj(String key) {
            return this.optIntegerObj(key, 0);
        }
    
        /**
         * Get an optional integer value associated with a key, or the default if there
         * is no such key or if the value is not a number. If the value is a string,
         * an attempt will be made to evaluate it as a number.
         *
         * @param key
         *            A key string.
         * @param defaultValue
         *            The default.
         * @return An object which is the value.
         */
        public Integer optIntegerObj(String key, Integer defaultValue) {
            final Number val = this.optNumber(key, null);
            if (val == null) {
                return defaultValue;
            }
            return val.intValue();
        }
    

    Unfortunately I've forgotten all the little I learnt about forking/creating branches/submitting pull requests etc, and Github doesn't make it particularly easy unless you're already familiar with how to do it - I've made the changes over on https://github.com/davejbur/JSON-java/tree/add-object-based-versions-int-float but the diff seems to think I've deleted and redone huge chunks instead of just adding four methods!

    Perhaps someone could either tell me where I've gone wrong with Github, or just add the code above in to the master anyway.

    Thanks! Dave

    opened by davejbur 0
  • JSONObject constructors do not check for non-finite numbers

    JSONObject constructors do not check for non-finite numbers

    Problem The constructors org.json.JSONObject.JSONObject(Map<?, ?>) and org.json.JSONObject.JSONObject(Object) do not check occuring numbers in values for finiteness and thus allow creating of invalid JSON object which then run into strange behaviour when stringifying.

    The Map constructor even mentiones @throws JSONException - If a value in the map is non-finite number. but this exception can only occur here when a nested call throws it, e.g. a value with a List containing non-finite numbers.

    Code example

    import static org.junit.jupiter.api.Assertions.assertThrows;
    import java.util.Map;
    import org.json.JSONException;
    import org.json.JSONObject;
    import org.junit.jupiter.api.Test;
    
    class JSONObjectTest {
        @Test void jsonObject_map() {
            assertThrows(JSONException.class, () -> new JSONObject(Map.of("a", Double.POSITIVE_INFINITY)));
        }
    
        @Test void jsonObject_bean() {
            assertThrows(JSONException.class, () -> new JSONObject(new MyBean()));
        }
        public static class MyBean {
            public double getA() { return Double.POSITIVE_INFINITY; }
        }
    }
    

    Both tests fail and instead the constructors return an instance of a JSONObject with a key "a" mapped to a non-finite double.

    Cascading problems Calling toString() on the returned JSONObject will internally throw a JSONException in toString(0) while writing the non-finite value and this will be catched resulting in a null returned from the method. obj.getDouble("a") on the other hand will return the non-finite double.

    Idea While JSONObject.put(String, Object) checks for finiteness before putting the value to the map https://github.com/stleary/JSON-java/blob/5920eca2d7694c8d9a714bb280f31007ff64ade4/src/main/java/org/json/JSONObject.java#L1870-L1871 the other two calls https://github.com/stleary/JSON-java/blob/5920eca2d7694c8d9a714bb280f31007ff64ade4/src/main/java/org/json/JSONObject.java#L291 https://github.com/stleary/JSON-java/blob/5920eca2d7694c8d9a714bb280f31007ff64ade4/src/main/java/org/json/JSONObject.java#L1552 just wrap() the value so it might be a good idea to do the finiteness-check there and document the JSONException.

    opened by Madjosz 0
  • XML.toJSONObject  may lead to StackOverflowError which may lead to dos   when parses untrusted xml

    XML.toJSONObject may lead to StackOverflowError which may lead to dos when parses untrusted xml

    Poc code as follow:

    public class poc {
    
    
        public static void main(String[] args) throws  JSONException {
    
    
            String s="<a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a>";
            XML.toJSONObject(s);
    
        }
    }
    

    and the. result: image

    Active discussion 
    opened by BIngDiAn-cn 0
  • License change request

    License change request

    @douglascrockford

    The license was changed to "Public Domain" in PR #688. However, the meaning of "public domain" is a bit ambiguous (e.g. "public domain" is not defined in the law of Japan.) So users can't judge whether they can use JSON-java or not. I guess that it opposes your intention.

    To resolve this problem, could you change the license to 0BSD or MIT-0? Or could you agree to change the license to one of two licenses?

    I asked you because I read this message

    The original author of the application, Douglas Crockford, selected the license. Please reach out to him if you would like to see any changes.

    Active discussion 
    opened by kk-zu 2
  • Unclear relevance relative to other JSON libraries (particularly javax.json)

    Unclear relevance relative to other JSON libraries (particularly javax.json)

    Our team needs to receive and send JSON and wants to use a JSON library to facilitate that. org.json provides org.json.JSONObject while javax.json-api provides javax.json.JsonObject. The purposes of both libraries are clearly similar, and while there are obvious differences like licencing (this one is public domain), it takes time for evaluators to determine how to choose between these 2 options. And there are more, including Gson and Jackson.

    Please provide a comparison, either as a feature table or as free-form text to help making a choice. If a third-party offers a neutral comparison, linking to it could suffice. If not, creating a comparison which focuses on comparing to javax.json-api would already be a good start. I would prioritize listing advantages of org.json, whether in terms of performance, flexibility or simplicity, but disadvantages would also help greatly.

    A few resources already help:

    Active discussion Available for someone to work on 
    opened by Chealer 0
Releases(20220924)
  • 20220924(Sep 24, 2022)

    | Pull Request | Description | |---------------|--------------| | #688 | Update copyright to Public Domain | | #687 | Fix a typo | | #685 | JSONObject map type unit tests | | #684 | Remove v7 build from pipeline | | #682 | JSONString similarity | | #675 | https://github.com/stleary/JSON-java/pull/675 |

    Source code(tar.gz)
    Source code(zip)
  • 20220320(Mar 20, 2022)

  • 20211205(Dec 5, 2021)

    | Pull Request | Description | |---------------|--------------| | #651 | IdentityHashSet for JSONObject cycle detection | | #646 | XMLParserConfiguration defined json arrays option | | #645 | Handle circular references in Java beans | | #640 | Unit tests for multiple backslashes in JSONPointer | | #637 | Reorganized README.md | | #634 | Update README with Unix examples | | #631 | Refactor JSONPointerTest | | #626 | Add CODE_OF_CONDUCT.md | | #622 | Clean up readme.md | | #621 | Clean up comments | | #617 | JSONObject.similar() numeric compare bug fix | | #613 | JsonObject.similar() number entry check bug fix | | #610 | optJSONObject() add default value | | #607 | Add Security.md policy page | | #606 | Clean up comments, add suppressWarning annotation | | #604 | Fixed incorrect cast getting float from array | | #601 | Added Examples.md for new users | | #594 | JSONStringer.java: fix max nesting level in javadoc |

    Source code(tar.gz)
    Source code(zip)
  • 20210307(Mar 8, 2021)

    | Pull Request | Description | |---------------|--------------| | #575 | Fix similar compare numbers | | #577 | Added clear() methods to JSONObject and JSONArray | | #581 | Use built-in Gradle shorthand notation for Maven Central repository | | #583 | Checked the length of key for checker framework | | #588 | JSONPointer should not process reverse solidus or double-quote chars in tokens |

    NOTE:

    #588 is a potentially breaking change to JSONPointer. Embedded double quote and backslash chars are now handled differently (they are basically ignored by the JSONPointer parser). If this causes problems to your project, post an issue on the JSON-Java GitHub page.

    Source code(tar.gz)
    Source code(zip)
  • 20201115(Nov 15, 2020)

    | Pull Request | Description | |---------------|--------------| | #515 | Merge tests and pom and code | | #519 | Gradle support | | #521 | Updates Cookie class to be more generic in attribute parsing and emit | | #524 | JSONArray does not have constructor to allocate the specified initial capacity | | #525 | Unit test fixes | | #526| Comment out some broken unit tests | | #527 | Fixes for Unit tests and supports GitHub Actions | | #529 | Added putAll(Collection) and putAll(Array) methods | | #532 | Verifies BigDecimal support does not have a regression| | #538 | Explain local builds in the readme, fix a couple of typos | | #539 | Bring Junit tests to Java 1.6 compatibility | | #540 | Added type conversion support | | #542 | Fix xml hex entity parse | | #543 | Refactor XMLConfiguration to use Builder Pattern | | #549 | Update readme.md | | #552 | Updates for JSONArray.putAll methods | | #570 | Readme - fix spelling and usage, per Grammarly |

    Source code(tar.gz)
    Source code(zip)
  • 20200518(May 18, 2020)

    | Pull Request | Description | |---------------|--------------| | #502 | Update JSONTokener text in README | | #499 | Add copyright to some files | | #495 | Refactor typos from code | | #494 | Replace JSONObject constructor string arrays with var args | | #492 | Clarify output of JSONArray toList() | | #486 | Standardize some exception messages | | #485 | Fix EOF error when Meta tag isn't closed at end of input. | | #483 | Update README.md to point to latest released jar | | #481 | Clarify exception when parser reads JSON | | #475 |Make private methods static where possible | | #474 | Replaces an internally used inefficient StringBuffer class |

    Source code(tar.gz)
    Source code(zip)
  • 20190722(Jul 23, 2019)

    | Pull Request | Description | |---------------|--------------| | #467 | add configuration for xsi:nil="true" conversion to null | | #452 | Adds check for EOF | | #440 | Corrections to BigDecimal consistency | | #432|Update README.md | |#421 |add isEmpty and isNotEmpty methods | |#417 |fix double ctor in JSONWriter | |#412 |Initial implementation of XMLParserConfig object for flexible XML Parsing | | #407 | Fix for invalid processing of trailing / for JSON Pointer | | #406 | Adds annotations to customize field names during Bean serialization |

    Source code(tar.gz)
    Source code(zip)
  • 20180813(Aug 14, 2018)

    Pull Request | Description ---- | ---- #405 | Update javadoc to match actual exceptions thrown. BREAKING CHANGE: JSONObject(Map) now throws an exception if any of a map keys are null. | #403 | Ignore Intellij Idea project files #400 | XML toJSONObject(Reader reader)

    Source code(tar.gz)
    Source code(zip)
  • 20180130(Jan 31, 2018)

    Pull Request | Description ------------ | ------------- #392| Remove wrong apostrophe #381 | Adding maven badge to readme #380 | Fix for false positives in similar functions #375 | fixes wrapped exceptions #373 | Fixes Unclosed json array stack overflow

    Source code(tar.gz)
    Source code(zip)
  • 20171018(Oct 18, 2017)

    Pull Request | Description ------------ | ------------- #362 | Fixes XML Unescaping #360 | Creating a JSONObject from a string that contains a duplicate key (any level) throws a JSONException that includes location #357 | Update javadoc according to issue #356 #354 | Updates for populateMap based on discussion in #279 and #264 #352 | Error message position fixes #348 | Capacity improvements for internal structures #347 | A comment added to explain the use of HashMap #345 | Adds JSONException for write value errors #341 | Optimize loops #337 | Optimizes opt* functions #336 | Numeric enhancements, Refactoring, Fix spelling

    Source code(tar.gz)
    Source code(zip)
  • 20170516(May 16, 2017)

    Pull Request | Description ------------ | ------------- #324 | Allow user to invoke query and optQuery ,with a JSONPointer #317 | make sure locale independent data is not upper/lowercased incorrectly #304 | Update README #292 | Provides "#" string evaluation support for JSON Pointer #288 | Bug fixes for XML Encoding and Decoding #274 | Fix for number output bug. #271 | Update enum support to be more fully featured.

    Source code(tar.gz)
    Source code(zip)
  • 20160810(Aug 10, 2016)

  • 20160807(Aug 7, 2016)

    | Pull Request | Description | | --- | --- | | https://github.com/stleary/JSON-java/pull/253 | Optional type conversion for XML reading | | https://github.com/stleary/JSON-java/pull/249 | Reduce the use of unnecessary exceptions | | https://github.com/stleary/JSON-java/pull/246 | Add License file | | https://github.com/stleary/JSON-java/pull/242 | Update readme | | https://github.com/stleary/JSON-java/pull/236 | Make nextString throw a JSONException instead of a NumberFormatException | | https://github.com/stleary/JSON-java/pull/234 | JSONPointer fix | | https://github.com/stleary/JSON-java/pull/226 | fix to compile with 1.6.0_45 | | https://github.com/stleary/JSON-java/pull/222 | JSON Pointer implementation | | https://github.com/stleary/JSON-java/pull/219 | Added CSV change to CDL.java | | https://github.com/stleary/JSON-java/pull/203 | Adds JSONArray toList method and JSONObject toMap method |

    Source code(tar.gz)
    Source code(zip)
  • 20160212(Feb 13, 2016)

    Extending backwards compatibility to Java 1.6. The unit tests [https://github.com/stleary/JSON-Java-unit-test] still require Java 1.8. Includes the following commits:

    | Pull Request | Description | | --- | --- | | https://github.com/stleary/JSON-java/pull/195 | Java 1.6 compatibility | | https://github.com/stleary/JSON-java/pull/188 | Fix negative zero | | https://github.com/stleary/JSON-java/pull/186 | Update README with number information | | https://github.com/stleary/JSON-java/pull/185 | change to public: write(writer, indentfactor, indent) | | https://github.com/stleary/JSON-java/pull/180 | Remove executable bit | | https://github.com/stleary/JSON-java/pull/179 | Update JavaDoc for JSONObject Constructors |

    Source code(tar.gz)
    Source code(zip)
  • 20151123(Nov 24, 2015)

    Support initializing a JSONObject with Map<?,?> and JSONArray with Collection<?>. Includes the following commits:

    | Pull request | Description | | --- | --- | | #168 | Update Readme for Maven release | | #160 | Fixe possible NullPointerException | | #159 | Properly override Exception class | | #153 | JSONObject and JSONArray initialization |

    Source code(tar.gz)
    Source code(zip)
  • 20150729(Sep 21, 2015)

    Code changes since the most recent Maven release (20141113):

    | Existing feature enhancements | Pull request | | --- | --- | | New methods for Enum type | https://github.com/douglascrockford/JSON-java/pull/140 | | BigDecimal and BigInteger methods | https://github.com/douglascrockford/JSON-java/pull/135 | | Iterable JSONArray | https://github.com/douglascrockford/JSON-java/pull/132 | | Remove compiler cast warnings | https://github.com/douglascrockford/JSON-java/pull/122 | | JavaDoc fix in CDL | https://github.com/douglascrockford/JSON-java/pull/120 | | Fix for JSONML.toString() | https://github.com/douglascrockford/JSON-java/pull/118 | | Fix for JSONArray.toString() | (direct commit) https://github.com/douglascrockford/JSON-java/commit/d6ba31819c48db39be068c8b3b1fa985df09ea65 |

    Source code(tar.gz)
    Source code(zip)
MapNeat is a JVM library written in Kotlin that provides an easy to use DSL (Domain Specific Language) for transforming JSON to JSON, XML to JSON, POJO to JSON in a declarative way.

MapNeat is a JVM library written in Kotlin that provides an easy to use DSL (Domain Specific Language) for transforming JSON to JSON, XML to JSON, POJ

Andrei Ciobanu 59 Sep 17, 2022
A simple java JSON deserializer that can convert a JSON into a java object in an easy way

JSavON A simple java JSON deserializer that can convert a JSON into a java object in an easy way. This library also provide a strong object convertion

null 0 Mar 18, 2022
JSON to JSON transformation library written in Java.

Jolt JSON to JSON transformation library written in Java where the "specification" for the transform is itself a JSON document. Useful For Transformin

Bazaarvoice 1.3k Dec 30, 2022
Generate Java types from JSON or JSON Schema and annotates those types for data-binding with Jackson, Gson, etc

jsonschema2pojo jsonschema2pojo generates Java types from JSON Schema (or example JSON) and can annotate those types for data-binding with Jackson 2.x

Joe Littlejohn 5.9k Jan 5, 2023
Essential-json - JSON without fuss

Essential JSON Essential JSON Rationale Description Usage Inclusion in your project Parsing JSON Rendering JSON Building JSON Converting to JSON Refer

Claude Brisson 1 Nov 9, 2021
A 250 lines single-source-file hackable JSON deserializer for the JVM. Reinventing the JSON wheel.

JSON Wheel Have you ever written scripts in Java 11+ and needed to operate on some JSON string? Have you ever needed to extract just that one deeply-n

Roman Böhm 14 Jan 4, 2023
A JSON Schema validation implementation in pure Java, which aims for correctness and performance, in that order

Read me first The current version of this project is licensed under both LGPLv3 (or later) and ASL 2.0. The old version (2.0.x) was licensed under LGP

Java Json Tools 1.5k Jan 4, 2023
JSON-LD implementation for Java

JSONLD-Java is looking for a maintainer JSONLD-JAVA This is a Java implementation of the JSON-LD 1.0 specification and the JSON-LD-API 1.0 specificati

null 362 Dec 3, 2022
A Java serialization/deserialization library to convert Java Objects into JSON and back

Gson Gson is a Java library that can be used to convert Java Objects into their JSON representation. It can also be used to convert a JSON string to a

Google 21.7k Jan 8, 2023
A universal types-preserving Java serialization library that can convert arbitrary Java Objects into JSON and back

A universal types-preserving Java serialization library that can convert arbitrary Java Objects into JSON and back, with a transparent support of any kind of self-references and with a full Java 9 compatibility.

Andrey Mogilev 9 Dec 30, 2021
A modern JSON library for Kotlin and Java.

Moshi Moshi is a modern JSON library for Android and Java. It makes it easy to parse JSON into Java objects: String json = ...; Moshi moshi = new Mos

Square 8.7k Dec 31, 2022
A fast JSON parser/generator for Java.

fastjson Fastjson is a Java library that can be used to convert Java Objects into their JSON representation. It can also be used to convert a JSON str

Alibaba 25.1k Dec 31, 2022
Sawmill is a JSON transformation Java library

Update: June 25, 2020 The 2.0 release of Sawmill introduces a breaking change to the GeoIpProcessor to comply with the updated license of the MaxMind

Logz.io 100 Jan 1, 2023
Genson a fast & modular Java <> Json library

Genson Genson is a complete json <-> java conversion library, providing full databinding, streaming and much more. Gensons main strengths? Easy to use

null 212 Jan 3, 2023
Fast JSON parser for java projects

ig-json-parser Fast JSON parser for java projects. Getting started The easiest way to get started is to look at maven-example. For more comprehensive

Instagram 1.3k Dec 26, 2022
Lean JSON Library for Java, with a compact, elegant API.

mJson is an extremely lightweight Java JSON library with a very concise API. The source code is a single Java file. The license is Apache 2.0. Because

Borislav Iordanov 77 Dec 25, 2022
A compiler built in Java that allows to translate xml format to json.

A compiler built in Java that allows to translate xml format to json. Getting Started Welcome to the VS Code Java world. Here is a guideline to help y

Víctor Andrés Rojas 1 Jan 6, 2022
Elide is a Java library that lets you stand up a GraphQL/JSON-API web service with minimal effort.

Elide Opinionated APIs for web & mobile applications. Read this in other languages: 中文. Table of Contents Background Documentation Install Usage Secur

Yahoo 921 Jan 3, 2023
Java libraries for serializing, deserializing, and manipulating JSON values

java-json-toolkit The json-toolkit repository contains the code to the following libraries: json-toolkit-text: basic library for conversion between te

d-coding GmbH 2 Jan 26, 2022