Error: Invalid export data. Please provide an array of object
garg10may opened this issue · 20 comments
Error: Invalid export data. Please provide an array of object
for a valid object
can you provide a sample data?
[
{
"Test Cohort Version": "5",
"Study": "CINC280X2105C",
"Category": "Screen Testing",
"CheckId": "sdfsdf",
"Description": "f",
"Instructions": "sdfds"
},
{
"Test Cohort Version": "5",
"Study": "CINC280X2105C",
"Category": "Screen Testing",
"CheckId": "sfadsfds",
"Description": "f",
"Instructions": "sdfds"
}
]
Can't reproduce your case. You can fork a repro on https://codepen.io/zheeeng/pen/PQxBKr, I will dig into your issue.
any update?
This example https://codepen.io/zheeeng/pen/PQxBKr is using your sample data. Can you provide a more concrete example?
I am using the same json structure
This example works correctly. If any reproduction can be provided will be much helpful to solve your problem.
Help me. I am having the same problem
Help me. I am having the same problem
Please provide repro for contributing debug.
@rajukumar-rjk Hey, thx for using. Would you mind posting your sample data here for contributing debug this issue? https://codesandbox.io/s/test-export-from-json-p9qgz2
@rajukumar-rjk Hey, thx for using. Would you mind posting your sample data here for contributing debug this issue? https://codesandbox.io/s/test-export-from-json-p9qgz2
It worked there. but it gives error when I use same data in the react project. I have attached the json
exportFromJsonData.txt
@rajukumar-rjk Hey, thx for using. Would you mind posting your sample data here for contributing debug this issue? https://codesandbox.io/s/test-export-from-json-p9qgz2
It worked there. but it gives error when I use same data in the react project. I have attached the json exportFromJsonData.txt
Is there some wrapped data structure passed? For example, reactive data created by Mobx or others?
@rajukumar-rjk Hey, thx for using. Would you mind posting your sample data here for contributing debug this issue? https://codesandbox.io/s/test-export-from-json-p9qgz2
It worked there. but it gives error when I use same data in the react project. I have attached the json exportFromJsonData.txt
Is there some wrapped data structure passed? For example, reactive data created by Mobx or others?
No. it just simple array, exactly what I have shared with you.
@rajukumar-rjk export-from-json asserts input data is Array
via such implementation https://github.com/zheeeng/export-from-json/blob/master/src/utils.ts#L1-L3
, if possible you can try test your input's type.
@garg10may try this
let data = [
{
"Test Cohort Version": "5",
"Study": "CINC280X2105C",
"Category": "Screen Testing",
"CheckId": "sdfsdf",
"Description": "f",
"Instructions": "sdfds"
},
{
"Test Cohort Version": "5",
"Study": "CINC280X2105C",
"Category": "Screen Testing",
"CheckId": "sfadsfds",
"Description": "f",
"Instructions": "sdfds"
}
]
let fileName = 'example'
let exportType = exportFromJSON.types.xls;
exportFromJSON({ data: data, fileName: fileName, exportType: exportType })
it's work in my case
@garg10may try this
let data = [ { "Test Cohort Version": "5", "Study": "CINC280X2105C", "Category": "Screen Testing", "CheckId": "sdfsdf", "Description": "f", "Instructions": "sdfds" }, { "Test Cohort Version": "5", "Study": "CINC280X2105C", "Category": "Screen Testing", "CheckId": "sfadsfds", "Description": "f", "Instructions": "sdfds" } ] let fileName = 'example' let exportType = exportFromJSON.types.xls; exportFromJSON({ data: data, fileName: fileName, exportType: exportType })it's work in my case
This solve my problem too.