Comments (3)
use BSON then, it's language-agnostic and fast to parse
from json5.
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.
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)
- Rename `master` branch to `main` HOT 1
- Explain use cases front and center HOT 3
- Module '"node_modules/json5/lib/index"' has no default export HOT 1
- Support Integers outside the range `[-(2**53)+1, (2**53)-1]` HOT 6
- SyntaxError when require()ing JSON5 file in Jest test HOT 1
- Prototype Pollution in JSON5 HOT 11
- json5 latest is now 1.0.2 on npmjs - intentional? HOT 3
- Support Template Literals using backticks? HOT 1
- Provide `exports` config in `packages.json`
- Multiline JSON doesn't multiline HOT 1
- add key property support ? HOT 1
- Add `comma-dangle` option
- Online JSON5 Editor(Formatter) is misleading? HOT 2
- Use .substring() instead of the deprecated .substr()
- Cannot stringify "\u0000"
- transitive dependency 'minimist' needs to be updated by rebuilding HOT 1
- question: commented unreachable code HOT 10
- JSON5.stringify() option: `trailingCommas` HOT 2
- Focus on ESNext HOT 1
- CLI should process consecutive JSONs
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from json5.