nbsdx / simplejson Goto Github PK
View Code? Open in Web Editor NEWSimple C++ JSON library
Simple C++ JSON library
Can I include the source in an open source project, and redistribute the source, with due acknowledgements, under a
Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International Public License
http://creativecommons.org/licenses/by-nc-sa/4.0/legalcode
http://creativecommons.org/licenses/by-nc-sa/4.0/
?
including json.hpp
in multiple cpp files leads to linker errors:
file1.o: In function `json::Array()':
json.hpp:410: multiple definition of `json::Array()'
file2.o:json.hpp:410: first defined here
file1.o: In function `json::Object()':
json.hpp:421: multiple definition of `json::Object()'
Compiler is gcc 5.1.1 building on Fedora 22
Clang warns us that
Moving a temporary object prevents copy elision
I think that we generally don't want to be using std::move in the return statement.
Since this project seems to be dead, I forked and fixed all open issues, merged the pull requests, added some new features and added a API documentation.
You can find it here: https://github.com/nwrkbiz/Cpp-SupportLibrary/blob/master/JSON.h
See:
Line 569 in 8dd3e9b
Should be:
c = str[ offset ];
No increment of offset should happen here, otherwise parsing of numbers in scientific representation will fail.
Why not to use STL-like syntax for initializing pairs of elements?
Like this:
map <int, int> example =
{
{1, 5},
{4, 7}
}
While i was testing SimpleJSON security i found a crash during string parsing inside parse_string function , below a screenshot.
This seems to be an information leak bug since the parser will try to parse a string until it found a matching " character in order to close the string inside the object, so providing something similar will result in a read out of bounds!
Step to reproduce:
Let me know if you need more information!
Regards,
Daniele Linguaglossa
[DELETED]
Hi @nbsdx, I'm a postdoctoral researcher at Fermilab (a department of energy laboratory in the Chicago suburbs). I'm working on a journal publication describing a physics simulation tool called MARLEY. A few years ago I found this repo and adapted your SimpleJSON code into a configuration file parser for MARLEY (here's the altered code if you're curious: https://github.com/sjgardiner/marley/blob/master/include/marley/JSON.hh). Thanks for sharing your work, it saved me a lot of pain!
I'd like to cite the SimpleJSON library in my journal article, which includes a lot of material about implementation details. Would you please email me when you get the chance (my address is my last name "@fnal.gov") and let me know what author name I should use in the bibliography? If possible, I'd really like to give you credit for your hard work.
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.