Git Product home page Git Product logo

Comments (3)

laktak avatar laktak commented on July 17, 2024

Thanks for the input but this sounds like a problem of JSON, not Hjson. If JSON loses the type information we can hardly get it back by guessing it in Hjson.

I see that this would be a nice workaround for your issue but it has too many drawbacks to implement it here.

If you simply want a workaround you could just walk your object tree yourself and reuse DSF from Hjson to parse any string values:

// init
var runDsf = dsf.loadDsf(dsfDef, "parse");
// parse:
var dsfValue = runDsf(value);

from hjson-js.

ehmicky avatar ehmicky commented on July 17, 2024

Thanks for looking this up.

I don't think that's a problem with JSON. JSON was designed as a portable and minimalist data-interchange format, i.e. to be simple and have few types. But this does not mean it cannot be augmented with type information, while still keeping JSON syntax. Providing both the decoder and the encoder agree on some way to decode/encode type information, it is possible. An example of a high profile project that does exactly this is transit-format.

The outcome is that Hjson could be serialized to and parsed from JSON without losing DSL type information. This would allow Hjson to use DSL in a similar way YAML uses tags.

If this still does not convince you, you can close this issue, I understand if you think this might not fit in Hjson. 😃

from hjson-js.

laktak avatar laktak commented on July 17, 2024

I'm sorry but this not the purpose of Hjson. You are welcome to fork or reuse the DSF parts though.

from hjson-js.

Related Issues (20)

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.