GithubHelp home page GithubHelp logo

oleg-cherednik / json-jackson-impl Goto Github PK

View Code? Open in Web Editor NEW
5.0 5.0 4.0 530 KB

An implementation of json-api for Jackson Project.

Home Page: https://github.com/oleg-cherednik/json-jackson-impl

Java 100.00%
jackson jackson-json java java-8 java-json java-json-library json json-api

json-jackson-impl's People

Contributors

oleg-cherednik avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

json-jackson-impl's Issues

Add PrettyPrint option

This time json write use only single string format. We have to implement option to use pretty print format.

How to use ObjectMapper to read a JSON file having the content map of maps?

I have a JSON file that has the following structure:

Map<Enum1, Map<Enum2, Map<Enum3, Map<Enum4, Map<Enum5, Map<String, String>>>>>>

How do I read the content of the file into the above map structure?

I have tried the following, but Eclipse gave an error The type Map is not generic; it cannot be parameterized with arguments <String, String>:

ObjectMapper mapper = new ObjectMapper();

TypeReference<Map<Enum1, Map<Enum2, Map<Enum3, Map<Enum4, Map<Enum5, Map<String, String>>>>>>>
        typeRef =
        new TypeReference<Map<Enum1, Map<Enum2, Map<Enum3, Map<Enum4, Map<Enum5, Map<String, String>>>>>>>() {
        };

mapper.readValue(file, typeRef);

The content of the file looks like this:

{
  "enum1": {
    "enum2": {
      "enum3": {
        "enum4-1": {
          "enum5-1": {
            "example1": "example1 string",
            "example2": "example2 string"
          },
          "enum5-2": {
            "example1": "example1 string",
            "example2": "example2 string"
          }
        },
        "enum4-2": {
          "enum5-1": {
            "example1": "example1 string",
            "example2": "example2 string"
          },
          "enum5-2": {
            "example1": "example1 string",
            "example2": "example2 string"
          }
        }
        ....
      }
      .....
    }
  }

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.