Why can't Python parse this JSON data?

后端 未结 9 2457
傲寒
傲寒 2020-11-21 05:06

I have this JSON in a file:

{
    \"maps\": [
        {
            \"id\": \"blabla\",
            \"iscategorical\         


        
9条回答
  •  离开以前
    2020-11-21 05:39

    There are two types in this parsing.

    1. Parsing data from a file from a system path
    2. Parsing JSON from remote URL.

    From a file, you can use the following

    import json
    json = json.loads(open('/path/to/file.json').read())
    value = json['key']
    print json['value']
    

    This arcticle explains the full parsing and getting values using two scenarios.Parsing JSON using Python

提交回复
热议问题