About 149,000 results
Open links in new tab
  1. python - How to prettyprint a JSON file? - Stack Overflow

    You can do this on the command line: python3 -m json.tool some.json (as already mentioned in the commentaries to the question, thanks to @Kai Petzke for the python3 suggestion).

  2. Formatting JSON in Python - Stack Overflow

    Nov 6, 2018 · I tried with pprint, but it actually wouldn't print the pure JSON string unless it's converted to a Python dict, which loses your true, null and false etc valid JSON as mentioned in the other answer. As well it doesn't retain the order in which the items appeared, so it's not great if order is important for readability.

  3. How can I print specific values from a json file with python?

    for key, value in json_data.iteritems(): result = value['result'] print result UPDATE (for question in comments): If you have multiple files and want to store all of the info at once - try throwing it all into a dictionary.

  4. How to print particular JSON value in Python? - Stack Overflow

    Feb 1, 2012 · JSON print specific value in Python. 0. Print specific value. 0. How to print specific data from json file ...

  5. pretty-print json in python (pythonic way) - Stack Overflow

    Can't pretty print json from python. 6. JSON pretty print multiple lines. 14. Pretty print JSON python. 1.

  6. python - Selecting fields from JSON output - Stack Overflow

    Aug 4, 2016 · Assuming you are dealing with a JSON-string in the input, you can parse it using the json package, see the documentation. In the specific example you posted you would need

  7. 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. No matter what you do). But, json.dumps() works on both Python 2 and 3.

  8. Getting values from JSON using Python - Stack Overflow

    Note that json.loads converts json arrays into lists. If you need to get a value of a dictionary in a list, then you will need to index the list for the dictionary first to get the value. This is an easy mistake to make especially if an API returns a JSON array with a single object in it. For example:

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

    Parsing by any of the above methods will result, by default, in a perfectly ordinary Python data structure, composed of the perfectly ordinary built-in types dict, list, str, int, float, bool (JSON true and false become Python constants True and False) and NoneType (JSON null becomes the Python constant None).

  10. How to beautify JSON in Python? - Stack Overflow

    pretty-print json in python (pythonic way) 40. Coloring JSON output in python. 1.