0

i have an string for example

var = "{"name":"angelo","apellido":"enriquez"}"

but when doing the following function I get an error

data = json.loads(var)

Error : No JSON object could be decoded Any help?

1
  • please select an answer if this helped Commented Jun 19, 2015 at 6:31

2 Answers 2

1

Replace your var with :

var = '{"name":"angelo","apellido":"enriquez"}'

i.e put the content inside {} within single quotes (') instead of double .

Hope that helps .

Sign up to request clarification or add additional context in comments.

1 Comment

YEAH , IT WORKS THNKS
0

First of all you are not writing good json in javascript, replace inner " double quotes with single ' quotes.

var MyJSVar = {'hello':'bra'}

If string

var MyJSVar = "{'hello':'bra'}"

2 Comments

is beacause i'm reading from a file .. and returns me a str i guess that it is between " ...."
i use Readlines and this iterate into a loop

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.