condor888
asked on
use shell script to parse json returned by a restful service
I have a Restful web service with a URL like "http://myhost:5000/getname" to return a JSON string like this:
Now that I need to use Linux shell to call the web service and parse the returned JSON string to get the first name and last name. They need to be stored into two variebles and printed out.
Please use out-of-box shell scripting. Don't use any utilities that need to be installed separately.
I am new to shell scripting, so would some one please kindly share your thoughts? Thanks!
{"firstName": "john", "lastName": "doe"}
.Now that I need to use Linux shell to call the web service and parse the returned JSON string to get the first name and last name. They need to be stored into two variebles and printed out.
Please use out-of-box shell scripting. Don't use any utilities that need to be installed separately.
I am new to shell scripting, so would some one please kindly share your thoughts? Thanks!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Here is a rather good bash guide/tutorial:
http://www.bash.academy/
A comprehensive list of tutorials available on the web:
http://wiki.bash-hackers.org/scripting/tutoriallist
Finally, this is the complete bash Reference Manual:
https://www.gnu.org/software/bash/manual/bash.html
As for "awk", which is kind of a languange on its own:
A tutorial (one of many out there): http://www.grymoire.com/Unix/Awk.html
The user's Guide: https://www.gnu.org/software/gawk/manual/gawk.html
I'm sure you'll find tons of other resources by searching the web.
Have fun and success!
wmp
http://www.bash.academy/
A comprehensive list of tutorials available on the web:
http://wiki.bash-hackers.org/scripting/tutoriallist
Finally, this is the complete bash Reference Manual:
https://www.gnu.org/software/bash/manual/bash.html
As for "awk", which is kind of a languange on its own:
A tutorial (one of many out there): http://www.grymoire.com/Unix/Awk.html
The user's Guide: https://www.gnu.org/software/gawk/manual/gawk.html
I'm sure you'll find tons of other resources by searching the web.
Have fun and success!
wmp
ASKER
Ok, I will check them out. Thank you again for providing good learning resources.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks for the solutions. It helped a lot!
ASKER