Sign inSign up

ibmcom/jsoncpp-ppc64le

By ibmcom

•Updated over 7 years ago

Docker image for jsoncpp-ppc64le

Image
0

448

ibmcom/jsoncpp-ppc64le repository overview

⁠Author

"Jay Joshi [email protected]⁠"

⁠Based On

https://github.com/open-source-parsers/jsoncpp.git⁠

⁠Usage Information

jsoncpp (package)

#Build and run the container:

$docker build -t jsoncpp . $docker run --name demo_jsoncpp -i -t jsoncpp /bin/bash

Test the working of Container:

#Create file alice.json with the following contents:

{ "book":"Alice in Wonderland", "year":1865, "characters": [ {"name":"Jabberwock", "chapter":1}, {"name":"Cheshire Cat", "chapter":6}, {"name":"Mad Hatter", "chapter":7} ] }

#Create file alice.cpp with following contents:

#include #include #include </jsoncpp/dist/json/json.h> // or jsoncpp/json.h , or json/json.h etc.

using namespace std;

int main() { ifstream ifs("alice.json"); Json::Reader reader; Json::Value obj; reader.parse(ifs, obj); // reader can also read strings cout << "Book: " << obj["book"].asString() << endl; cout << "Year: " << obj["year"].asUInt() << endl; const Json::Value& characters = obj["characters"]; // array of characters for (int i = 0; i < characters.size(); i++){ cout << " name: " << characters[i]["name"].asString(); cout << " chapter: " << characters[i]["chapter"].asUInt(); cout << endl; } }

#Compile it:

g++ -std=c++11 -o alice alice.cpp -ljsoncpp

#Then run it:

./alice

#Output:

Book: Alice in Wonderland Year: 1865 name: Jabberwock chapter: 1 name: Cheshire Cat chapter: 6 name: Mad Hatter chapter: 7

#Additional examples are available at: https://en.wikibooks.org/wiki/JsonCpp⁠

⁠Publication Statement

"This content is the sole responsibility of the entity that makes it available. IBM may review content to determine whether it is illegal or violates IBM policies, and IBM may remove or refuse to display content that IBM reasonably believe violates IBM policies or the law. For more information please see:

DMCA Takedown Policy: https:https://help.github.com/articles/dmca-takedown-policy⁠ IBM Takedown and DMCA Notices Website: https://www.ibm.com/legal/us/en/dmca.html⁠ IBM Copyright and Trademark Information Website: https://www.ibm.com/legal/us/en/copytrade.shtml⁠."

Please contact [email protected]⁠ ( if this content is found to be in violation of the DMCA or any related licenses or publishing conditions.

⁠Community Support

For any questions on the publication of this container, please contact us at [email protected]⁠.

Tag summary

Content type

Image

Digest

Size

457.3 MB

Last updated

over 7 years ago

docker pull ibmcom/jsoncpp-ppc64le