Coder Social home page Coder Social logo

jackson-datatype-json-org's People

Contributors

arturdryomov avatar benmccann avatar cowtowncoder avatar frankwis avatar gedmarc avatar mpoindexter avatar prb avatar squiddle avatar valery1707 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

jackson-datatype-json-org's Issues

Exception when serializing a JSONObject with null values

When attempting to serialize a JSONObject with a null value the following exception is thrown:

java.util.NoSuchElementException: JSONObject["xxxx"] not found.
at org.json.JSONObject.get(JSONObject.java:220)
at com.fasterxml.jackson.datatype.jsonorg.JSONObjectSerializer.serializeContents(JSONObjectSerializer.java:57)
at com.fasterxml.jackson.datatype.jsonorg.JSONObjectSerializer.serialize(JSONObjectSerializer.java:28)
at com.fasterxml.jackson.datatype.jsonorg.JSONObjectSerializer.serialize(JSONObjectSerializer.java:14)

It seems like the following code in JSONObjectSerializer

        try {
            ob = value.get(key);
        } catch (JSONException e) {
            throw new JsonGenerationException(e);
        }
        if (ob == null || ob == JSONObject.NULL) {
            if (provider.isEnabled(SerializationConfig.Feature.WRITE_NULL_MAP_VALUES)) {
                jgen.writeNullField(key);
            }
            continue;
        }

should instead be:

        try {
            ob = value.opt(key);
        } catch (JSONException e) {
            throw new JsonGenerationException(e);
        }
        if (ob == null || ob == JSONObject.NULL) {
            if (provider.isEnabled(SerializationConfig.Feature.WRITE_NULL_MAP_VALUES)) {
                jgen.writeNullField(key);
            }
            continue;
        }

Add a MIT/GNU/? License

Great little library but without a License it is rather useless. Would it be possible to add a License file?

Thanks,

Tim

Misleading exception when trying to deserialize JSON String as `org.json.JSONArray` value

public class TestDomain {
    private Integer id;
    private String name;
    private Double da;
    private LocalDateTime ldt;
    private LocalDate ld;
    private LocalTime lt;
    private JSONObject jsn;
    private JSONArray jsa;
}

execute code

public static void main(String[] args)  {

		Map map = new HashMap();
		map.put("name", "zpj");
		map.put("id", 111);
		map.put("jsa", "[1, 34, 32, \"zpj\", {\"age\": 18, \"name\": \"zpj\", \"child\": {\"name\": \"zzy\", \"gender\": \"nan\"}}, {\"url\": \"test\", \"name\": \"suhu\"}]");

		ObjectMapper om = new ObjectMapper();
		om.registerModule(new JsonOrgModule());
		TestDomain td = om.convertValue(map, TestDomain.class);
		System.out.println(td);
	}
Exception in thread "main" java.lang.IllegalArgumentException: Can not deserialize instance of org.json.JSONArray out of FIELD_NAME token
throws java.lang.IllegalArgumentException: Can not deserialize instance of org.json.JSONArray out of

Change `json-20090211_1` dependency to work on Java 9

I get this is the wrong place. But I could not find the home for geronimo bundles. Is far as I can tell is is dead.

However in my attempts to modularize my quandl library which depends on com.jimmoores:quandl-core which in turn depends on this somehow, I discovered that the automatic module naming algorithm fails to name the json-2090211_1 with a valid module name.

I have found that if the line 'Automatic-Module-Name: org.json' is added to the MANIFEST.MF in the META-INF within the json-20090211_1.jar then my library compiles.

FYI...

Use OSGi ready org.json dependency

I think the OSGi ready dependency would be more appropriate selection for this library. Please consider to change the dependency for example to this:

<dependency>
    <groupId>org.apache.geronimo.bundles</groupId>
    <artifactId>json</artifactId>
    <version>20090211_1</version>
</dependency>

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.