I have a json returned with the Google Vision API that is the result of the upload of 3 different images, but in the same upload ...
[
{
"errorMessage": "",
"errorStatus": false,
"fileMimeType": "image/jpeg",
"fileName": "19091_047031795420170519212400126191-1-3.jpg",
"meanConfidence": 100,
"milliSecondsEmployed": 206650,
"ocrInUse": true,
"pageCount": 1,
"pageDataList": [
{
"height": 2631,
"pageNumber": 1,
"rawText": "texto completo",
"textSegments": [
{
"geometry": {
"x": 1694.25,
"y": -57
},
"orientation": 0,
"text": "texto"
}
],
"width": 1860
}
],
"pending": false
},
{
"errorMessage": "",
"errorStatus": false,
"fileMimeType": "image/jpeg",
"fileName": "19091_047031795420170519212400126191-1-3.jpg",
"meanConfidence": 100,
"milliSecondsEmployed": 206654,
"ocrInUse": true,
"pageCount": 1,
"pageDataList": [
{
"height": 2631,
"pageNumber": 1,
"rawText": "texto completo",
"textSegments": [
{
"geometry": {
"x": 594.75,
"y": -134.25
},
"orientation": 0,
"text": "texto"
}
],
"width": 1860
}
],
"pending": false
},
{
"errorMessage": "",
"errorStatus": false,
"fileMimeType": "image/jpeg",
"fileName": "19091_047031795420170519212400126191-1-2.jpg",
"meanConfidence": 100,
"milliSecondsEmployed": 238255,
"ocrInUse": true,
"pageCount": 1,
"pageDataList": [
{
"height": 2631,
"pageNumber": 1,
"rawText": "texto completo",
"textSegments": [
{
"geometry": {
"x": 101.25,
"y": -69.75
},
"orientation": 0,
"text": "texto"
}
],
"width": 1860
}
],
"pending": false
}
]
I have greatly shortened its format for this example ... what I want is that the pages are added to a new json, so that they are grouped as in this other json:
[
{
"errorMessage": "",
"errorStatus": false,
"fileMimeType": "application/pdf",
"fileName": "19091_047031795420170519212400126191-1.pdf",
"meanConfidence": 100,
"milliSecondsEmployed": 4750,
"ocrInUse": false,
"pageCount": 2,
"pageDataList": [
{
"height": 841.8898,
"pageNumber": 1,
"rawText": "texto completo",
"textSegments": [
{
"geometry": {
"x": 368.24878,
"y": -58.73446
},
"orientation": 0,
"text": "texto"
}]
},
{
"height": 841.8898,
"pageNumber": 2,
"rawText": "texto completo",
"textSegments": [
{
"geometry": {
"x": 47.452,
"y": -73.23697
},
"orientation": 0,
"text": "texto"
}]
}
],
"pending": false
}
]
That is, that all pages go inside pageDataList, not that a different page is created for each page. How can I change from one type of json to the other?