Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7676707
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T17:15:35+00:00 2026-05-31T17:15:35+00:00

I am doing some json parsing in a bash script: curl http://myurl.com/get.json | sed

  • 0

I am doing some json parsing in a bash script:

curl http://myurl.com/get.json | sed -e 's/[{}]/''/g' | awk -v k="text" '{n=split($0,a,","); for (i=1; i<=n; i++) print a[i]}' | grep '"key":' | sed 's/:/ /1' | awk -F" " '{ print $2 }' | tr -d "\""

Now I want to take this to AppleScript but I’m a little confused with the escaping.
When I escpape all the " so I get this:

do shell script "curl http://myurl.com/get.json | sed -e 's/[{}]/''/g' | awk -v k=\"text\" '{n=split($0,a,\",\"); for (i=1; i<=n; i++) print a[i]}' | grep '\"key\":' | sed 's/:/ /1' | awk -F\" \" '{ print $2 }' | tr -d \"\"\""

it returns an error:

sh: -c: line 0: unexpected EOF while looking for matching `"'
sh: -c: line 1: syntax error: unexpected end of file

I’d really appreciate some help here! Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T17:15:36+00:00Added an answer on May 31, 2026 at 5:15 pm

    You were close – the escape character also needs to be escaped in that last bit:

    do shell script "curl http://myurl.com/get.json | sed -e 's/[{}]/''/g' | awk -v k=\"text\" '{n=split($0,a,\",\"); for (i=1; i<=n; i++) print a[i]}' | grep '\"key\":' | sed 's/:/ /1' | awk -F\" \" '{ print $2 }' | tr -d \"\\\""
    

    Edit: I thought I got them all, but it looks like there may be an extra \” needed in that last bit.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i am doing JSON parsing for particular web service with different IDs,Parsing returns some
Need some advise on what I am doing wrong during client JSON parsing... Tips
Possible Duplicate: Converting XML to JSON using Python? I'm doing some work on App
For some reason when i tested parsing a json string to a dropdownlist it
I am doing some work with C#, AJAX and JSON and am getting a
I am currently working on an application which is parsing some JSON data in
I am doing optimization of web app, where I get list data in JSON
Hi got a weird problem parsing JSON for some reason can't access the values
I'm having difficulty parsing some JSON data returned from my server using jQuery.ajax() To
I have a GWT app and I'm using RequestBuilder get GET some json from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.