How to Add a JSON File as a Data Source (no Headers)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-13-2025 12:37 PM - edited 03-13-2025 12:39 PM
I have a JSON file with multiple objects in an array:
[{"pidm":"6#####","cnumber":"C########","stst_code":"AS","gpa_ind":"T","guest_ind":"F","hold_ind":"T","hold_codes":"MC","source":"YourDataSource40"},
{"pidm":"7#####","cnumber":"C########","stst_code":"AS","gpa_ind":"T","guest_ind":"F","hold_ind":"F","hold_codes":null,"source":"YourDataSource41"},
{"pidm":"8#####","cnumber":"C########"","stst_code":"AS","gpa_ind":"T","guest_ind":"F","hold_ind":"F","hold_codes":null,"source":"YourDataSource42"}]
I have created the data source, below:
Attempting to test load data throws this error: "No fields provided for mapping to headers".
Since their are no headers, I've tried using this transform script:
// Convert the entire incoming JSON object into a string
var jsonObject = source; // source contains the incoming JSON object
var jsonString = JSON.stringify(jsonObject);
// Map the JSON string to a field in the target table
target.json_data = jsonString; // Assuming the field in the target table is 'json_data'
However, I am still getting the same error. For reference, I am trying to map each row from the JSON array into a single column on a custom table.
Thank you!