Received data from external system in Object format. Due to this not able to read the content in a tool. To read the content need to convert into Array format. How to convert object into Array ?
Sample content:
{
headers: {
date: Mon, 25 Jan 2021 13:41:24 GMT,
server: Microsoft-IIS/10.0,
cache_control: private, max-age:600,
content_type: application/json; odata.metadata=minimal; odata.streaming=true; charset=utf-8,
content_encoding: gzip,
vary: Accept-Encoding,
strict_transport_security: max-age=31536000; preload,
odata_version: 4.0,
x_powered_by: ASP.NET,
transfer_encoding: chunked
},
response: {
_odata.context: https://extranet.who.int/xmart-api/odata/NCOV_CAA/$metadata#FACT_VAC_OUTPUT,
value: [
{
DATE: 2020-12-15,
BATCH_ID: 30057,
ROUND_FK: 2,
ALG_VERSION_ID: 1,
PARTICIPANT_FK: BEL,
VAC_PRODUCT_FK: VA_S1,
ALLOCATION_ROUND: 50000,
PARTICIPANT_RANK: 1,
ALLOCATION_TOTAL: 50000,
},
{
DATE: 2020-12-15,
BATCH_ID: 90015,
ROUND_FK: 9,
ALG_VERSION_ID: 1,
PARTICIPANT_FK: KEN,
VAC_PRODUCT_FK: VA_S1,
ALLOCATION_ROUND: 234000,
PARTICIPANT_RANK: 1,
ALLOCATION_TOTAL: 234000,
}
]
},
Status code: 200,
Error: ,
Body: {"@odata.context":"https://extranet.who.int/xmart-api/odata/NCOV_CAA/$metadata#FACT_VAC_OUTPUT","value":[{"DATE":"2020-12-15","BATCH_ID":30057,"ROUND_FK":"2","ROUND_FK__Sys_ID":"36bb74ed-d034-4120-a324-5f9e16ffd6d9","ROUND_FK__CODE":2,"ALG_VERSION_ID":"1","PARTICIPANT_FK":"BEL","PARTICIPANT_FK__Sys_ID":"6a16fdc9-b523-48e3-be6b-d0493f9c1ff4","PARTICIPANT_FK__PARTICIPANT_ID":"BEL","VAC_PRODUCT_FK":"VA_S1","VAC_PRODUCT_FK__Sys_ID":"c6a93e69-c478-43cf-a3b1-bf691bb815f5","VAC_PRODUCT_FK__VAC_PRODUCT_ID":"VA_S1","ALLOCATION_ROUND":50000,"PARTICIPANT_RANK":1,"ALLOCATION_TOTAL":50000,"_RecordID":"04bf1656-d868-48a8-a12f-0050d137aaab","Sys_RowTitle":"30057BELVA_S1","Sys_Version":1,"Sys_VersionID":"04BF1656-D868-48A8-A12F-0050D137AAAB.1","Sys_OriginID":"d36dbe35-aade-4c0e-9f2b-fb9d52e44878","Sys_OriginCode":"SYS_MART_IMPORT","Sys_LoadBy":"xAdmin","Sys_CommitDateUtc":"2021-01-25T09:23:38.463Z","Sys_FirstLoadBy":"xAdmin","Sys_FirstCommitDateUtc":"2021-01-25T09:23:38.463Z","Sys_ID":"0…
}
Expected output with below fields in Array
DATE
BATCH_ID
ROUND_FK
ALG_VERSION_ID
PARTICIPANT_FK
VAC_PRODUCT_FK
ALLOCATION_ROUND
PARTICIPANT_RANK
ALLOCATION_TOTAL
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Hello @bnrinbox ,
Object can be converted to an array using the map() function or for loop. Refer to the below links for more information https://www.digitalocean.com/community/tutorials/4-uses-of-javascripts-arraymap-you-should-know#step-4-—-reformatting-array-objects
https://stackoverflow.com/questions/9606812/how-to-convert-an-object-into-an-array-in-javascript
Hope this helps!
Cheers, Lalitha
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Scale up as you grow — whether you're running one virtual machine or ten thousand.

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.
