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 8419513
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T02:38:05+00:00 2026-06-10T02:38:05+00:00

I am accessing a service that is returning json as follows: { A:A value,

  • 0

I am accessing a service that is returning json as follows:

{
"A":"A value",
"B":{
      "B1":"B1 value",
      "B2":"B2 value"
    },
"C":{
               "c_url":"http:\/\/someurl:someport\/somefolder\/somefile",

    }
}

What I want to do is parse this json and get the url and the somefile portion of the folder in a key-value pair.

So, essentially, after my script is done processing the json, it will output the url and the somefile in some delimited fashion in a file.

The output after the file has processed the above provided json would be:

url: http://someurl:someport/somefolder/somefile
file: somefile

I am pretty sure there are numerous json parsers in python that will parse the json but how would I deal with the url string that has been pre-processed with escape characters? Do I need to write my own url-encoder that will strip out the escape characters from the url string?

Also, I would need to tokenize the individual components of the url to get to the ‘file’ portion, are there any libraries that can help with that?

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-06-10T02:38:07+00:00Added an answer on June 10, 2026 at 2:38 am

    Your example JSON doesn’t need the comma after the “c_url” k-v pair.

    >>> import json
    >>> st = '{"A":"A value","B":{ "B1":"B1 value", "B2":"B2 value" },"C":{ "c
    _url":"http:\/\/someurl:someport\/somefolder\/somefile" }}'
    >>> json.loads(st)
    {u'A': u'A value', u'C': {u'c_url': u'http://someurl:someport/somefolder/somefile'}, u'B': {u'B1': u
    'B1 value', u'B2': u'B2 value'}}
    

    And to get just the ‘somefile’ part of the URL:

    url.split('/')[url.count('/')]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This relates to my other question on accessing a REST service that uses forms
I have a asp.net website and I am accessing that web service from my
A web service that I am accessing send the following response... <strong>result</strong> How can
If I run ASP.NET, and I am accessing a foreign asmx web service that
I'm accessing a SOAP 1.1 web service, and it's returning a fault. The web
I am working on a project accessing web service. I found a project http://d1xzuxjlafny7l.cloudfront.net/downloads/PromoTest.zip
I am getting an error while accessing the core service on SDL Tridion 2011
I am accessing an existing WCF web service (which returns a PDF as a
I am writing a web service client for accessing Rally using Java and the
I have a Windows Service which is basically accessing a mailbox and reading the

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.