I need to parse JSON using shell script (I used to use Python, but not allowed in this specific environment), in this example, I want to get the value of b1, which is 6.5, anyone have any experience?
Using Linux/Mac OSX.
{
"value": {
"a1": {
"amount": "5.5",
"currency": "USD"
},
"b1": {
"amount": "6.5",
"currency": "USD"
},
"c1": {
"d1": {
"amount": "7.5",
"currency": "USD"
},
"e1": {
"amount": "8.5",
"currency": "USD"
},
"f1": {
"amount": "9.5",
"currency": "USD"
}
},
"g1": {
"amount": "10.5",
"currency": "USD"
},
}
}
source(==.) command and then extracts necessary data. Just two files created in your home dir. To use an instantly ready library with a decent parser or to stay with a regular expression — well, it's your choice, indeed. If you or your customer plan to perform any further development — I'd stay with the library.