dataProvider valid data format | Community
Skip to main content
broman__pl
August 4, 2022
Question

dataProvider valid data format

  • August 4, 2022
  • 1 reply
  • 878 views

I'm playing with data providers in target and face an issue when try to send array to target. I'm getting error“Invalid Json. Location: line - 1, column - 653.”

And it corresponds with array as value for property

this one is fine

"param1": "test", "param2": 123

but payload like this causing error 

"param1": "test", "param2": ["test", "test2"]

In documentation is says "params: A JSON object ... " and my payload is a valid json object

 

 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

1 reply

Perrin_Ennen
Community Advisor
Community Advisor
August 9, 2022
...
var data = {
  "param1": "test",
  "param2": 123
}

...

data = JSON.parse(data); // maybe this line helps
callback(error, data);

Maybe it is enough if you use JSON.parse.

 

best regards

broman__pl
August 10, 2022

This code will throw and error as data is already JSON

Issue is with more complex values like arrays. Which still are valid in JSON object but at.js throwing error about them. Question is if data can be any json object or just list of key values pairs where values are simple types like string, number, boolean?

Amelia_Waliany
Adobe Employee
Adobe Employee
August 24, 2023

Thanks for your question broman__pl, and thanks  for your reliably thoughtful guidance! I know this question is a few years old but in case anyone wants to try to take a stab at it to close it out with deeper insights, please do 😊 Cheers!

CC our brilliant Advisors:  , and 

and our inspiring Mentors: @abhilashsape@Gokul_Agiwal@Rajneesh_Gautam_@PratheepArunRaj, and @Sneha-Parmar