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

  • Home
  • SEARCH
  • 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 8585145
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T21:59:16+00:00 2026-06-11T21:59:16+00:00

import json import simplejson import urllib2 data = urllib2.urlopen(‘www.example.com/url/where/i/get/json/data’).read() j = j = simplejson.loads(data)

  • 0
import json
import simplejson
import urllib2

data = urllib2.urlopen('www.example.com/url/where/i/get/json/data').read()

j = ""
j = simplejson.loads(data)

dump_data=simplejson.dumps(j)

for data in j["facets"]:
    print data.items()
    print "\n----------------\n"
  • 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-11T21:59:17+00:00Added an answer on June 11, 2026 at 9:59 pm

    The error message says it all. Clearly j["facets"] is an iterable which contains at least some strings instead of containing some other datatype which has an items method. (maybe you expected a dict)?

    Try printing j["facets"] to see what you’re actually getting there. Then you might be able to figure out why you’re getting a string instead of the expected object (dict).

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

Sidebar

Related Questions

The following code: import simplejson,urllib,urllib2 query=[u'नेपाल'] urlbase=http://search.twitter.com/search.json values={'q':query[0]} data=urllib.urlencode(values) req=urllib2.Request(urlbase,data) response=urllib2.urlopen(req) json=simplejson.load(response) print json
currently I have the following which parses a json api.. import simplejson import urllib2
This is code in python, doesn't work and unknown motive. import json, urllib2 url
import json array = '{"fruits": ["apple", "banana", "orange"]}' data = json.loads(array) That is my
Is there a way to import data from a JSON file into R? More
My code is not working: package com.foo.json; import javax.xml.bind.annotation.XmlRootElement; import com.sun.jersey.api.client.Client; import com.sun.jersey.api.client.WebResource; @XmlRootElement
import httplib2 from urllib import urlencode h = httplib2.Http() h.add_credentials('zackster@gmail.com', 'PassWord') data = dict(key=ThisIsMyApiKeyICopiedAndPastedIt)
problem is self explanatory: import simplejson as json a = u[(datetime.datetime(2012, 3, 13, 14,
import simplejson as json results = Content.objects.filter(blah) theresult_json = json.dumps(results) This doesn't work!!
I have this code: >>> import simplejson as json >>> keys = dict([(x, x**3)

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.