Expecting value: line 1 column 1 (char 0) python
<p>I'm newbie in python and trying to parse data in my application using these lines of codes</p>

<pre><code>json_str = request.body.decode('utf-8') 
py_str = json.loads(json_str)
</code></pre>

<p>But I'm getting this error on <code>json.loads</code></p>

<blockquote>
  <p>Expecting value: line 1 column 1 (char 0)</p>
</blockquote>

<p>this is json formatted data that I send from angular app (Updated)</p>

<blockquote>
  <p>Object { ClientTypeId: 6, ClientName: "asdasd", ClientId: 0, PhoneNo: "123", FaxNo: "123", NTN: "1238", GSTNumber: "1982", OfficialAddress: "sads", MailingAddress: "asdasd", RegStartDate: "17-Aug-2016", 15 moreâ¦ }</p>
</blockquote>

<p>these are the values that I get in <code>json_str</code> </p>

<blockquote>
  <p>ClientTypeId=5&amp;ClientName=asdasd&amp;ClientId=0&amp;PhoneNo=123&amp;FaxNo=123&amp;NTN=123&amp;GSTNumber=12&amp;OfficialAddress=adkjh&amp;MailingAddress=adjh&amp;RegStartDate=09-Aug-2016&amp;RegEndDate=16-Aug-2016&amp;Status=1&amp;CanCreateUser=true&amp;UserQuotaFor=11&amp;UserQuotaType=9&amp;MaxUsers=132123&amp;ApplyUserCharges=true&amp;ApplyReportCharges=true&amp;EmailInvoice=true&amp;BillingType=1&amp;UserCharges=132&amp;ReportCharges=123&amp;MonthlyCharges=123&amp;BillingDate=16-Aug-2016&amp;UserSessionId=324</p>
</blockquote>

<p>I don't know what's wrong in it.. can anyone mention what's the mistake is??</p>

<p>Your data is not <a href="https://en.wikipedia.org/wiki/JSON" rel="nofollow">JSON-formatted</a>, not even the one you included in your updated answer.  Your data is a JavaScript-object, not an encoded string.  Please note the "N" in JSON: Notation -- it is a format inspired from how data is written in JavaScript code, but runtime JavaScript data is not represented in JSON.  The "JSON" you pasted is how your browser represents the object to you, it is not proper JSON (that would be <code>{"ClientTypeId": 6, ...}</code> -- note the quotes around the property name).</p>

<p>When sending this data to the server, you have to encode it. You think you are sending it JSON-encoded, but you aren't.  You are sending it "web form encoded" (data of type <a href="https://en.wikipedia.org/wiki/Percent-encoding#The_application.2Fx-www-form-urlencoded_type" rel="nofollow"><code>application/x-www-form-urlencoded</code></a>).</p>

<p>Now either you have to learn how to send the data in JSON format from Angular, or use the correct parsing routine in Python: <a href="https://docs.python.org/3/library/urllib.parse.html#urllib.parse.parse_qs" rel="nofollow"><code>urllib.parse.parse_qs</code></a>.  Depending on the library you are using, there might be a convenience method to access the data as well, as this is a common use case.</p>

python angularjs json