bjouhier / i-json Goto Github PK
View Code? Open in Web Editor NEWFast incremental JSON parser
Fast incremental JSON parser
This error has reached if the library was compiled with the node js v0.12 or the last version of iojs
Can you do this?
It's very bad that JSON parses proto without any errors, it may cause a various bugs
Thanks!
> node-gyp rebuild
make: Entering directory `/tmp/i-json/build'
CXX(target) Release/obj.target/ijson_bindings/src/parser.o
../src/parser.cc: In member function ‘void ijson::Cache::intern(ijson::Parser*, char*, size_t, v8::Local<v8::Value>*, ijson::Cache*, uint64_t)’:
../src/parser.cc:95:66: error: ‘memcmp’ was not declared in this scope
if ((size_t)entry->len == len && !memcmp(p, entry->bytes, len)) {
^
../src/parser.cc:102:32: error: ‘memcpy’ was not declared in this scope
memcpy(entry->bytes, p, len);
^
../src/parser.cc: In function ‘int ijson::makeClass(const char*)’:
../src/parser.cc:204:37: error: ‘strlen’ was not declared in this scope
for (int i = 0, len = strlen(str); i < len; i++) {
^
make: *** [Release/obj.target/ijson_bindings/src/parser.o] Error 1
make: Leaving directory `/tmp/i-json/build'
gyp ERR! build error
gyp ERR! System Linux 3.13.0-32-generic
gyp ERR! node -v v0.10.30
gyp ERR! node-gyp -v v0.13.1
$ uname -a
Linux manta 3.13.0-32-generic #57-Ubuntu SMP Tue Jul 15 03:51:08 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
$ cat /etc/issue
Ubuntu 14.04.1 LTS \n \l
I was trying out this module and got two json files that can not be parsed.
The first npm.json
, taken from https://github.com/dscape/clarinet/blob/master/samples/npm.json fails with
/Users/dignifiedquire/work/codio/experiments/json/node_modules/i-json/index.js:6
if (typeof arg == "string") return this._update(new Buffer(arg, 'utf8'));
^
Error: line 1: syntax error near b\b@gmail.com"
at Parser.nat.Parser.update (/Users/dignifiedquire/work/codio/experiments/json/node_modules/i-json/index.js:6:43)
at /Users/dignifiedquire/work/codio/experiments/json/async.js:20:39
at Array.map (native)
at Object.exports.parse (/Users/dignifiedquire/work/codio/experiments/json/async.js:19:30)
at /Users/dignifiedquire/work/codio/experiments/json/naive.js:34:10
at time (/Users/dignifiedquire/work/codio/experiments/json/naive.js:21:5)
at Object.<anonymous> (/Users/dignifiedquire/work/codio/experiments/json/naive.js:33:1)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
The second one clang.ops.json
(120mb) which you can find here (https://dl.dropboxusercontent.com/u/6672418/clang.ops.json) fails with
[1] 67130 segmentation fault node naive.js
Tried parsing the following file with both c++ & javascript implementation
[
{
"key": "datacenter",
"city_id": 302,
"value": "us-east1"
},
{
"key": "datacenter.redirect",
"city_id": 301,
"value": false
},
{
"key": "territory.enabled",
"city_id": 300,
"value": false
},
{
"key": "webview.enabled",
"city_id": null,
"value": false
},
{
"key": "express.version",
"city_id": null,
"value": 3
}
]
The C++ parser reported the last value as 0
instead of 3
. The js parser threw an uncaught.
Materialization of the entire JSON object is sometimes unnecessary because only a few fields are accessed. For example, a long list requiring 15ms to parse may be accessed conditionally based on other properties of the object. If the properties can be materialized independently, the expensive parsing operation can be deferred until it is known if the data is actually required.
Do you have a sense of how difficult it might be to modify i-json to materialize only a requested property (perhaps via a V8 accessor or interceptor) instead of returning the entire object?
I'd be nice if this library had a parser.result()
vs parser.error()
instead of throwing on invalid JSON.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.