0

I'm trying to develop a new system that calculating genome parameters, and to get information from the command line I'd like to use JSON format. So I don't know how to use RapidJSON in my code to get information and show the results in JSON format by using RapidJSON in c++.

  • 2
    There is a RapidJSON tutorial: [Tutorial](http://rapidjson.org/md_doc_tutorial.html). Btw. _get information from the command line_ - You mean you pass the file name of a JSON file via command line? (Alternatively, you could use re-direction to pipe text in JSON format into std input of your program, and clever tools provide both options.) May be, it would be worth to clarify this. – Scheff's Cat Jan 21 '19 at 11:24
  • _Get information from the command line_ like this: **C:\Users\Shaig\Gene.exe {"hello": "world","t": true ,"f": false,"n": null,"i": 123,"pi": 3.1416,"a": [1, 2, 3, 4]}** – Sh.Mehdiyev Jan 21 '19 at 11:40
  • It'd be a lot simpler if the enter json string was a single command line argument. (Either way you have to make sure your shell doesn't eat the quote characters and such) – Shawn Jan 21 '19 at 11:59
  • If you really want to do it this way, just [read all the command line arguments](https://stackoverflow.com/a/50022085/7478597), concat them to one string, and let the JSON parser parse that string. However, I wouldn't recommend this way (as already pointed out by @Shawn). If your tool can read from standard input, you could provide your JSON input as [Here doc.](http://tldp.org/LDP/abs/html/here-docs.html). This would be as convenient as well but without the quoting issues... – Scheff's Cat Jan 21 '19 at 12:10
  • Thank you very much @Scheff My program will be on the web server and will be associated with the python script, that's why need to use JSON format by command line, for debugging any syntax error – Sh.Mehdiyev Jan 21 '19 at 16:14

0 Answers0