Code Monkey home page Code Monkey logo

ofxjson's Introduction

ofxjson's People

Contributors

andreasmuller avatar bakercp avatar jeffcrouse avatar kajiyu avatar mattfelsen avatar noio avatar yoiang avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ofxjson's Issues

Value::operator[] should accept std::size_t

https://github.com/jefftimesten/ofxJSON/blob/5934d7044406041d46c763d0509613ac71801256/libs/jsoncpp/include/json/json.h#L657
There are 2 overload that accept

  • int
  • ArrayIndex

According to line 236,
https://github.com/jefftimesten/ofxJSON/blob/5934d7044406041d46c763d0509613ac71801256/libs/jsoncpp/include/json/json.h#L236

typedef unsigned int ArrayIndex;

ArrayIndex is unsigned int.

Now, I'm tried to pass std::size_t value but failed.
https://travis-ci.org/Lacty/ToTheTop/builds/195512607
Because gcc defines std::size_t as unsigned long

According to C standerd, unsigned long is bigger or same with unsigned int. So, overload resolution was failed.

Why don't you accept std::size_t?
All of operator[] defined at STL container can accept std::size_t.

There are two scenarios to solve that.

  1. typedef std::size_t ArrayIndex;(breaking change!)
  2. Add overload for std::size_t(Note: SFINAE is required to avoid conflict with Json::ArrayIndex. ex.) http://melpon.org/wandbox/permlink/V24WVUhGMvc7SjQH)

License of `src/ofxJSONElement.*`

Text contents of src/ofxJSONElement.* files bear the following copyright indication:

 *  Created by Jeffrey Crouse on 12/17/10.
 *  Copyright 2010 Eyebeam. All rights reserved.

Eyebeam is not mentioned neither in license.md nor in README.md thus it is not clear what rights are reserved to that company. In strict sense "All rights reserved" imposes more conservative limitations than MIT license. Could the intention of the cited lines be clarified?

UTF-8

Hi,

Should this work with UTF-8 encoded files? If I try to open a file using json.open("file.json") that is UTF-8 encoded I get the following error:

ofxJSONElement::openLocal: Unable to parse file.json: * Line 1, Column 1
Syntax error: value, object or array expected.

If the same file is encoded as ANSI then it works fine.

issues on Linux?

I don't know if you've tried this addon on linux but I'm having trouble getting it through the precompiler. I've traced it down to the ofxJSON addon and the precompiler but haven't found a cause yet.

I can compile jsoncpp-0.5.0 using scons.

Errors are like:
In file included from /usr/include/c++/4.6/cstdio:44:0,
from /usr/include/c++/4.6/fstream:43,
from ../../z25-lib/unstable/openFrameworks/addons/../../ofAddons/ofxJSON/src/ofxJSONElement.h:14,
from ../../z25-lib/unstable/openFrameworks/addons/../../ofAddons/ofxJSON/src/ofxJSONElement.cpp:10:
/usr/include/stdio.h:940:1: error: expected declaration before ‘}’ token

I'll do some more digging but just to let you know...:

Ubuntu precise: gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.6/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 4.6.3-1ubuntu5' --with-bugurl=file:///usr/share/doc/gcc-4.6/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.6 --enable-shared --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.6 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --enable-plugin --enable-objc-gc --disable-werror --with-arch-32=i686 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5)

sometimes the ofxJson can not get the right info.

@jefftimesten
I want to get weather info by ofxJson, but some info will get wrong state different with the right.

1.Link address: http://www.weather.com.cn/data/sk/101200101.html
2.Get "WD" info:
string city = nowJson["weatherinfo"]["city"].asString();
string WD = nowJson["weatherinfo"]["WD"].asString();
translate to the wstring..
3.Can not get right info, but get the info "武汉" which should be get by "city".

Maybe it's my incorrect operation.
Wish to get your replay, thx.

simpledrunk
email: lihuan777#gmail.com

find the reason, it is really occur by my mistake... close.. - -||

Writing OF objects

Hi,

I would like to write the OF objects like ofImage in json format and read them as ofImage. How can I do this?

Regards

License

Can I assume that ofxJSON is MIT licensed as same as JsonCpp? Otherwise, could you provide a License for your ofxJSON?

Inserting an OFXJsonElement in another one

Hi, I read this forum post : https://forum.openframeworks.cc/t/create-your-own-json-data-and-save-json-file/16560

And tried to reproduce the example with ofxJSON.

But when I use an ofxJsonElement as value for another OfxJsonElement, it compiles fine, but crash when the code is executed.

My code in ofApp.h :

ofxJSONElement list;
ofxJSONElement papa;

My code in ofApp.cpp::setup :

list["yolo"]["pit"] = 1;
list["yolo"]["put"] = "morteau";
list["yolo"]["pot"] = 1.36;
papa["lol"]=666;
list["yolo"]["pot"]["54"] = papa;
ofLog() << list ;

The error I got :

std::_Tree_comp_alloc<std::_Tmap_traits<Json::Value::CZString,Json::Value,std::lessJson::Value::CZString,std::allocator<std::pair<Json::Value::CZString
const ,Json::Value> >,0> >::_Myhead(...) returned 0x5C28F5C7.

I use of0.9.8 with vs2015.

Regards

stop automatically sorting

Hi team, thanks for keeping this addon updated and easy to use.

Just wanted to flag that I've run into an issue where my JSON objects are ALWAYS sorted (alphabetically or by value) the moment I open the raw string with ofxJSONElement, while I need them to remain in the order in the raw string.

At the moment, I'm manually re-ordering them, but perhaps there's an easy way to stop this from happening?

Cheers!

Here's some example code:

ofxJSONElement json;
json.parse( "{ \"charlie\":4, \"alpha\":0.876, \"delta\":\"someString\", \"beta\":123 }" );

cout << json.getRawString();
// prints {"alpha":0.876,"beta":123,"charlie":4,"delta":"someString"}

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.