Python/Json:Expecting property name enclosed in double quotes

前端 未结 16 2374
南方客
南方客 2020-11-27 03:23

I\'ve been trying to figure out a good way to load JSON objects in Python. I send this json data:

{\'http://example.org/about\': {\'http://purl.org/dc/terms/         


        
16条回答
  •  旧时难觅i
    2020-11-27 03:26

    This:

    {'http://example.org/about': {'http://purl.org/dc/terms/title': [{'type': 'literal', 'value': "Anna's Homepage"}]}}
    

    is not JSON.
    This:

    {"http://example.org/about": {"http://purl.org/dc/terms/title": [{"type": "literal", "value": "Anna's Homepage"}]}}
    

    is JSON.

    EDIT:
    Some commenters suggested that the above is not enough.
    JSON specification - RFC7159 states that a string begins and ends with quotation mark. That is ".
    Single quoute ' has no semantic meaning in JSON and is allowed only inside a string.

提交回复
热议问题