-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
how to get only "name" from below json #1278
Comments
Assuming the JSON text above is in some file std::ifstream i("input.json");
json j = json::parse(i);
// iterate the outer array
for (json& entry : j)
{
// output the value at the "name" key
std::cout << entry["name"] << std::endl;
} |
@rijeshvp Do you need further support? |
Yes... please .. I forgot to mention that i am looking for a unix command... Will you be able to help me to have a unix command to extract the name element out of it. |
You should try jq:
|
I am getting this output when i am running following. so i will not be redirecting this to a file.. want to format it on the fly |
Please have a look at this tutorial |
[{"name":"local.tar.gz.part-ab","hash":"99f7ff566a910064f774fee3acc06287","bytes":5368709120,"last_modified":"2018-10-05T16:07:37.841000","content_type":"binary/octet-stream"},{"name":"local.tar.gz.part-ac","hash":"8fab90eaff4c5c447e0076b508e11a9e","bytes":5368709120,"last_modified":"2018-10-05T16:12:21.569000","content_type":"binary/octet-stream"},{"name":"local.tar.gz.part-ad","hash":"fd2c9aec58b0de0b13117245c6baf62a","bytes":5368709120,"last_modified":"2018-10-05T16:16:54.336000","content_type":"binary/octet-stream"},{"name":"local.tar.gz.part-ae","hash":"26188ef13ec623382748faf7f7a380b2","bytes":2329785943,"last_modified":"2018-10-05T16:18:53.909000","content_type":"binary/octet-stream"},{"name":"vmohswbre024_admin.tar.gz.aa","hash":"83f43b790013c1633e354bbc0a0fd4e9","bytes":4194304000,"last_modified":"2018-10-05T17:53:40.375000","content_type":"binary/octet-stream"}]
The text was updated successfully, but these errors were encountered: