# Double brackets on http GET to docparser

Hi,

I’m having some difficulties with the result of a GET request, where I think n8n is wrapping the response in an extra set of square brackets. I am calling the docparser API to get the output of a pdf parsing process. I’m successfully getting a response, but unfortunately the response is getting wrapped in an additional set of square brackets as follows:

[
[
{
"id": "id",
"document_id": "docparser_id",
"remote_id": "unique_internal_id",
"file_name": "filename.PDF",
"page_count": 1,
"processed_at": "2021-09-02T10:09:24+00:00",
"processed_at_utc": "2021-09-02T10:09:24+00:00",
"processed_at_user": "2021-09-02T10:09:24+00:00",
"servicedate": "29/06/2021",
"uprn": "122213",
"jobnumber": "3647299",
"engineerid": "5011795",
"contractorid": "169837",
"engineername": "John Smith"
}
]
]


I think this is preventing the response from being seen as JSON, and the Table just has all of the data stuffed into a single column, rather than a neat and tidy column for each of the JSON fields.

I’ve tried the same request with POSTMAN and it only has a single set of square brackets so I’m wondering if this is something that’s happening in n8n.

My workflow is below. Thanks in advance for any help.

{
"name": "read pdf blob and parse data with docparser",
"nodes": [
{
"parameters": {},
"name": "Start",
"type": "n8n-nodes-base.start",
"typeVersion": 1,
"position": [
150,
290
]
},
{
"parameters": {
"operation": "executeQuery",
"query": "=SELECT\n\tAuditUploadID,\t\n\tFileName,\n\tTO_BASE64(File) as binaryfield\nFROM\n\tVinylAudit.AuditUpload \nWHERE\nAuditUploadID = '{{$node[\"MySQL1\"].json[\"AuditUploadID\"]}}'" }, "name": "MySQL", "type": "n8n-nodes-base.mySql", "typeVersion": 1, "position": [ 630, 290 ], "credentials": { "mySql": "QA - PCL Audit" } }, { "parameters": { "mode": "jsonToBinary", "convertAllData": false, "sourceKey": "=binaryfield", "destinationKey": "binaryoutput", "options": { "dataIsBase64": true, "fileName": "={{$node[\"MySQL1\"].json[\"FileName\"]}}",
"mimeType": "={{$node[\"MySQL1\"].json[\"mimetype\"]}}" } }, "name": "Move Binary Data", "type": "n8n-nodes-base.moveBinaryData", "typeVersion": 1, "position": [ 870, 290 ] }, { "parameters": { "operation": "executeQuery", "query": "=SELECT\n\tau.AuditUploadID,\t\n\tau.FileName,\n\taus.AuditUploadStatus,\n\tut.Enum as UploadFileType,\n\tSUBSTRING_INDEX(au.FileName,'.',-1) as FileType,\n\tCASE\n\t\tWHEN SUBSTRING_INDEX(au.FileName,'.',-1) = 'csv' THEN 'text/csv'\n\t\tWHEN SUBSTRING_INDEX(au.FileName,'.',-1)\t = 'xlsx' THEN 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'\n\t\tWHEN SUBSTRING_INDEX(au.FileName,'.',-1) = 'xls' THEN 'application/vnd.ms-excel'\n\t\tWHEN SUBSTRING_INDEX(au.FileName,'.',-1) = 'pdf' THEN 'application/pdf'\n\t\tELSE 'application/octet-stream'\n\tEND AS mimetype\nFROM\n\tVinylAudit.AuditUpload au\n\tLEFT JOIN VinylAudit.UploadFileType AS ut ON au.UploadFileTypeID = ut.UploadFileTypeID\n\tLEFT JOIN VinylAudit.AuditUploadStatus AS aus ON au.AuditUploadStatusID = aus.AuditUploadStatusID\nWHERE\n\tSUBSTRING_INDEX(au.FileName,'.',-1) = 'pdf'\n\tAND DATE(AddedOn) = '2021-09-01'\nLIMIT 1" }, "name": "MySQL1", "type": "n8n-nodes-base.mySql", "typeVersion": 1, "position": [ 360, 290 ], "credentials": { "mySql": "QA - PCL Audit" } }, { "parameters": { "authentication": "basicAuth", "requestMethod": "POST", "url": "=https://api.docparser.com/v1/document/upload/<parserid>", "options": { "bodyContentType": "multipart-form-data" }, "bodyParametersUi": { "parameter": [ { "name": "file_content", "value": "={{$node[\"MySQL\"].json[\"binaryfield\"]}}"
},
{
"name": "file_name",
"value": "={{$binary.binaryoutput.fileName}}" }, { "name": "remote_id", "value": "={{$node[\"MySQL1\"].json[\"AuditUploadID\"]}}"
}
]
},
"parameter": []
}
},
"name": "HTTP Request",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 1,
"position": [
1130,
290
],
"credentials": {
"httpBasicAuth": "docparser"
}
},
{
"parameters": {
"authentication": "basicAuth",
"url": "=https://api.docparser.com/v1/results/<parserid>/{{\$json[\"id\"]}}",
"options": {},
"parameter": []
},
"queryParametersUi": {
"parameter": []
}
},
"name": "HTTP Request1",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 1,
"position": [
1400,
290
],
"credentials": {
"httpBasicAuth": "docparser"
}
}
],
"connections": {
"Start": {
"main": [
[
{
"node": "MySQL1",
"type": "main",
"index": 0
}
]
]
},
"MySQL": {
"main": [
[
{
"node": "Move Binary Data",
"type": "main",
"index": 0
}
]
]
},
"Move Binary Data": {
"main": [
[
{
"node": "HTTP Request",
"type": "main",
"index": 0
}
]
]
},
"MySQL1": {
"main": [
[
{
"node": "MySQL",
"type": "main",
"index": 0
}
]
]
},
"HTTP Request": {
"main": [
[
{
"node": "HTTP Request1",
"type": "main",
"index": 0
}
]
]
}
},
"active": false,
"settings": {},
"id": "6"
}



Hey @scottjscott!

Did you try using the Split Into Items additional option? To enable it follow these steps:

1. Click on Add Option and select Split Into Items from the dropdown menu.
2. Toggle Split Into Items to true.

If this doesn’t solve your issue, you can use the code snippet mentioned here in a Function node to change the structure. JavaScript Code Snippets | Docs

I’m running on 0.125.0 so I need to do an upgrade to take advantage of the Split Into Items I think. Thanks for the pointers. Tonight I will be doing my first upgrade to my dev environment…

Thanks @harshil1712 - I’ve upgraded to 0.136.0 and can now use Split Into Items and that’s worked a treat!

1 Like

That’s wonderful! Have fun