About 417,000 results
Open links in new tab
  1. python - Reading JSON from a file - Stack Overflow

    If you are reading the data from the Internet instead, the same techniques can generally be used with the response you get from your HTTP API (it will be a file-like object); however, it is heavily recommended to use the third-party Requests library instead, which includes built-in support for JSON requests.

  2. How can I parse (read) and use JSON in Python? - Stack Overflow

    Beware that .load is for files; .loads is for strings. See also: Reading JSON from a file. Occasionally, a JSON document is intended to represent tabular data.

  3. Reading a JSON file from S3 using Python boto3 - Stack Overflow

    Jan 13, 2018 · I kept following JSON in the S3 bucket test: { 'Details': "Something" } I am using the following code to read this JSON and printing the key Details: s3 = boto3.resource('s3', ...

  4. python - How do I write JSON data to a file? - Stack Overflow

    Basically, I think it's a bug in the json.dump() function in Python 2 only - It can't dump a Python (dictionary / list) data containing non-ASCII characters, even you open the file with the encoding = 'utf-8' parameter. (i.e.

  5. python - Loading and parsing a JSON file with multiple JSON …

    Jul 26, 2019 · In case you are using pandas and you will be interested in loading the json file as a dataframe, you can use: import pandas as pd df = pd.read_json('file.json', lines=True) And to convert it into a json array, you can use: df.to_json('new_file.json')

  6. How to get JSON from webpage into Python script

    Unfortunately, that doesn't work in Python 3. json.load is just a wrapper around json.loads that calls read() for a file-like object. json.loads requires a string object and the output of urllib.urlopen(url).read() is a bytes object. So one has to get the file encoding in order to make it work in Python 3.

  7. Read json file from python - Stack Overflow

    Oct 3, 2014 · Beside that, the code is passing file object, while json.loads accept a string. Pass a file content: json_data = json.loads(json_file.read()) or use json.load which accepts file-like object. json_data = json.load(json_file)

  8. Load part of a json in python - Stack Overflow

    While each entry is a JSON entry, the file as a whole is a valid JSON file. For example: "1":"Action" is proper JSON format, but you cannot load it on its own. In order to be able to import it as a JSON format, you'll need the full syntax of it {"1":"Action"} What you'll need to do is still load the whole file, then assign first 10 lines to a ...

  9. Read local JSON file with Python - Stack Overflow

    Jul 9, 2020 · As per the answers and some reading into the documentation, json.load() will allow for a file-like object and appears to be a better solution – plum 0 Commented Jul 9, 2020 at 15:44

  10. Reading JSON file with Python 3 - Stack Overflow

    I'm using Python 3.5.2 on Windows 10 x64. The JSON file I'm reading is this which is a JSON array containing 2 more arrays. I'm trying to parse this JSON file using the json module. As described in the docs the JSON file must be compliant to RFC 7159.

Refresh