GithubHelp home page GithubHelp logo

bemasher / jsongen Goto Github PK

View Code? Open in Web Editor NEW
209.0 10.0 14.0 436 KB

JSONGen is a tool for generating native Golang types from JSON objects.

License: GNU General Public License v3.0

Go 100.00%

jsongen's Issues

Unable to convert escaped JSON

Great tool, however it appears that it is unable to parse escaped JSON correctly

Valid JSON
{ "test":"Test String", "escapedJson":"{\\"test\\":\\"test\\"}" }

Keys should be camel-case

JavaScript Object Notation should adhere to JS convention, which is camel-case with leading lower-case character. In Go, leading uppercase is important to export the field. Though in JavaScript, uppercase variables denote a class, where as lower-case are used for variables and properties. Underscore separators will yield a valid identifier though they are a Ruby convention, not a JavaScript convention. Using a dash should be avoided because in JavaScript:

//This is invalid syntax:
obj.my-property;
//So the user must do:
obj["my-property"];
//Therefore, this is better:
obj.myProperty;

can't convert this type

Our service provider give this kind response,i can't use jsongen to convert it,any suggestions?

{
  "action":"GetMonitorResponse",
  "meter_set":[
    {
      "data":[
        [1392072000,[12,12]],
        [12,12],
        [12,12],
        [11,11],
        [11,11],
        [11,12],
        [15,23],
        [15,29],
        [11,12]
      ],
      "vxnet_id":"vxnet-0",
      "meter_id":"52:54:f4:98:5d:f3",
      "sequence":0
    },
    {
      "data":[
        [1392072000,[0,14440]],
        [0,13762],
        [0,13901],
        [0,14546],
        [0,14710],
        [0,14730],
        [0,14655],
        [0,14898],
        [0,14772]],
      "meter_id":"disk-os"
    },
    {
      "data":[
        [1392072000,7],
        7,
        7,
        7,
        7,
        6,
        7,
        11,
        7
      ],
      "meter_id":"cpu"
    }
  ],
  "ret_code":0,
  "resource_id":"i-1234abcd"}

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.