-1

I have a flask app that I'm passing a request to. If I pass the request as

request= '{"vec": [436, 131, 51]}'

I get a successful response, but if I pass

request= "{'vec': [436, 131, 51]}"

it fails with "unable to evaluate payload provided" - so single vs double quotes seem to matter. The issue I'm having is that the output from another script is a stringified json object, but this seems to be stored with the key in single quotes. I'm trying to understand why they are handled differently, and if there's a way to force it to be in the correct.

L Xandor
  • 1,659
  • 4
  • 24
  • 48
  • 3
    This is a JSON problem, not a Python problem. The top one is valid JSON; the bottom one isn't. Whatever is generating your payload with single quotes isn't giving you valid JSON. – khelwood Aug 26 '21 at 15:48

1 Answers1

0

RFC7159 defining JSON stipulates

A string begins and ends with quotation marks.

i.e. ", it does not allow ' unlike python

Daweo
  • 31,313
  • 3
  • 12
  • 25