Code Monkey home page Code Monkey logo

Comments (3)

rlidwka avatar rlidwka commented on June 24, 2024

use BSON then, it's language-agnostic and fast to parse

from json5.

jordanbtucker avatar jordanbtucker commented on June 24, 2024

From the json.org website (emphasis mine).

JSON (JavaScript Object Notation) is a lightweight data-interchange format. It is easy for humans to read and write. It is easy for machines to parse and generate. It is based on a subset of the JavaScript Programming Language, Standard ECMA-262 3rd Edition - December 1999. JSON is a text format that is completely language independent but uses conventions that are familiar to programmers of the C-family of languages, including C, C++, C#, Java, JavaScript, Perl, Python, and many others. These properties make JSON an ideal data-interchange language.

So you see, the purpose of JSON is not just that it is language agnostic and fast to parse, but that it is also easily readable and writable for humans. JSON5 is a bit of a trade-offโ€”far easier for humans to manipulate, only marginally more complex for computers to manipulate. I think the benefits outweigh the cost.

I think its best feature is how well if follows the Principle of Least Astonishment. Things you can do in JavaScript tend to just work in JSON5.

from json5.

aseemk avatar aseemk commented on June 24, 2024

Agreed, thanks for the response guys. =)

@mcharytoniuk: to add on, I wouldn't say the things you mention are "ambiguities" in the literal sense. The grammar (thanks @jordanbtucker!) is still concretely well-defined, and JSON5 is still ultimately a language-agnostic data format. (It just happens to be inspired by and a subset of JS in the same way that JSON originally was.)

I can't speak to performance, because that's comparing apples to oranges right now. The implementation in this repo is an example one based on Douglas Crockford's original JSON implementation, but browsers and other platforms have native JSON parsers these days. One day I hope/expect we'll see a prototype of a native JSON5 parser; then we can compare performance. =)

from json5.

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.