Jump to content

JSON Error: Unterminated String


This topic is 2501 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Trying to integrate FMP solution with Shippo using the Shippo API. When using Insert from URL step, response comes back with this error.

{"detail": "JSON parse error - Unterminated string starting at: line 1 column 25 (char 24)"}

 

Here's what Shippo specifies in their API, and below that, what FMP is sending (per Data Viewer). Any help resolving this issue is greatly appreciated.

 

From Shippo API:

'{
       "address_from":{
          "name":"Mr. Hippo",
          "street1":"215 Clayton St.",
          "city":"San Francisco",
          "state":"CA",
          "zip":"94117",
          "country":"US",
          "phone":"+1 555 341 9393",
          "email":"[email protected]"
       },
       "address_to":{
          "name":"Mrs. Hippo",
          "street1":"965 Mission St.",
          "city":"San Francisco",
          "state":"CA",
          "zip":"94105",
          "country":"US",
          "phone":"+1 555 341 9393",
          "email":"[email protected]"
       },
       "parcels":[{
          "length":"5",
          "width":"5",
          "height":"5",
          "distance_unit":"in",
          "weight":"2",
          "mass_unit":"lb"
       }],
       "async": false
    }'

 

Here's what FMP 16 Data Viewer shows:

{
	"address_from" : 
	{
		"city" : "Los Angeles",
		"country" : "US",
		"name" : "KL Test",
		"state" : "CA",
		"street1" : "Thompson Ave",
		"zip" : "91201"
	},
	"address_to" : 
	{
		"city" : "Los Angeles",
		"country" : "US",
		"name" : "David Test",
		"state" : "CA",
		"street1" : "1017 South Point View St",
		"zip" : "90035"
	},
	"parcels" : 
	{
		"parcels" : 
		[
			{
				"distance_unit" : "in",
				"height" : "5",
				"length" : "5",
				"mass_unit" : "lb",
				"weight" : "2",
				"width" : "5"
			}
		]
	}
}

 

 

 

 

 

Link to comment
Share on other sites

You have a 'parcels' key/node that is not correct.  It should immediately start with an array as per their API, you start it as another piece of JSON with another 'parcels' key name

  • Like 1
Link to comment
Share on other sites

On 5/21/2017 at 9:00 AM, Wim Decorte said:

You have a 'parcels' key/node that is not correct.  It should immediately start with an array as per their API, you start it as another piece of JSON with another 'parcels' key name

Thanks for the tip, Wim! I've attempted to build an array in the code after looking at an example online. The dataviewer seems to show the json output matching the API spec, but I'm still getting "{"detail": "JSON parse error - Unterminated string starting at: line 1 column 25 (char 24)"}"

Here's what the dataviewer now shows:

{
	"address_from" : 
	{
		"city" : "Los Angeles",
		"country" : "US",
		"name" : "KL Test",
		"state" : "CA",
		"street1" : "Thompson Ave",
		"zip" : "91201"
	},
	"address_to" : 
	{
		"city" : "Riverside",
		"country" : "US",
		"name" : "David Test",
		"state" : "CA",
		"street1" : "555 Some Street",
		"zip" : "90015"
	},
	"parcels" : 
	[
		{
			"distance_unit" : "in",
			"height" : "5",
			"length" : "5",
			"mass_unit" : "lb",
			"weight" : "2",
			"width" : "5"
		}
	]
}

 

Link to comment
Share on other sites

This topic is 2501 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.