Is there a simple way to check if the value of an object has been passed in node js? It does not seem to matter if the object in the module is defined as character or decimal.
For example, within the body of a request
{
"quantity": 1,
"weight": 100
}
when looking at the object "quantity": 1 ,
the error occurs when in the body of the request my client passes "quantity" : , specifying no value for quantity
{
"quantity": ,
"weight": 100
}
Unexpected token in JSON
-
- Profound User
- Posts: 21
- Joined: Mon Dec 15, 2014 5:21 pm
- First Name: Randy
- Last Name: Heinz
- Company Name: Southwestern Motor Transport
- Phone: 210.662.3272
- Address 1: 4600 Goldfield
- City: San Antonio
- State / Province: Texas
- Zip / Postal Code: 78218
- Country: United States
- Contact:
-
- Experienced User
- Posts: 2711
- Joined: Wed Aug 01, 2012 8:58 am
- First Name: Scott
- Last Name: Klement
- Company Name: Profound Logic
- City: Milwaukee
- State / Province: Wisconsin
Re: Unexpected token in JSON
Randy,
This is not a valid JSON object. It violates the syntax rules of the JSON standard. Nothing will be able to read this.
Fix whatever is creating the document like that.
Code: Select all
{
"quantity": ,
"weight": 100
}
Fix whatever is creating the document like that.
Who is online
Users browsing this forum: No registered users and 1 guest