Json data handling

Hi everyone, I need help with some data. I am receiving the information as follows:

[
{
"id": "2570a9d0-5e26-439b-8c1c-260a4c0eaba2",
"object": "item",
"folder_id": "HMjTb62mwPe",
"created_at": "2021-12-15T22:14:06.000000Z",
"sort_order": "14396928.000000000000000000000000000000",
"values": [
{
"id": "034783d5-738f-44ae-a1d0-7f2956860e81",
"object": "value",
"data": "c1966552301122185157",
"attribute_id": "44dbbdc2-9503-4e1c-97a2-c9af9c4624b7",
"item_id": "2570a9d0-5e26-439b-8c1c-260a4c0eaba2",
"attribute": {
"id": "44dbbdc2-9503-4e1c-97a2-c9af9c4624b7",
"object": "attribute",
"name": "ID-Contato",
"type": "text",
"default_data": "",
"settings": {
},
"created_by": 156711,
"created_at": "2021-11-29T18:10:10.000000Z",
"deleted": false
},
"deleted": false
},
{
"id": "2d311dba-2b39-479d-8822-f8a2fa622a52",
"object": "value",
"data": "Renata Barbosa",
"attribute_id": "180147b7-4884-417e-b029-d298cb1dde74",
"item_id": "2570a9d0-5e26-439b-8c1c-260a4c0eaba2",
"attribute": {
"id": "180147b7-4884-417e-b029-d298cb1dde74",
"object": "attribute",
"name": "Nome do cliente",
"type": "text",
"default_data": "",
"settings": {
},
"created_by": 156711,
"created_at": "2021-11-29T18:17:10.000000Z",
"deleted": false
},
"deleted": false
},
{
"id": "679a53d7-efe8-49e7-a552-360a9ed89003",
"object": "value",
"data": "15588966425",
"attribute_id": "318724af-d2a5-4603-8b2c-bfc4ab39c1dd",
"item_id": "2570a9d0-5e26-439b-8c1c-260a4c0eaba2",
"attribute": {
"id": "318724af-d2a5-4603-8b2c-bfc4ab39c1dd",
"object": "attribute",
"name": "ID-Cliente",
"type": "text",
"default_data": "",
"settings": {
},
"created_by": 156711,
"created_at": "2021-12-11T19:50:33.000000Z",
"deleted": false
},
"deleted": false
},
{
"id": "8cdf3b0c-5991-4c90-8f39-0a21e9b3cd12",
"object": "value",
"data": "#53",
"attribute_id": "8e011f83-4016-48a7-865c-209ee62eae1c",
"item_id": "2570a9d0-5e26-439b-8c1c-260a4c0eaba2",
"attribute": {
"id": "8e011f83-4016-48a7-865c-209ee62eae1c",
"object": "attribute",
"name": "id-pedido",
"type": "text",
"default_data": "",
"settings": {
},
"created_by": null,
"created_at": "2021-11-29T00:50:27.000000Z",
"deleted": false
},
"deleted": false
},
{
"id": "33fd5a55-90a2-4a77-92fa-1a6b91a294af",
"object": "value",
"data": 349,
"attribute_id": "0cc8b653-8cf2-4b71-817f-f16c4311f3ee",
"item_id": "2570a9d0-5e26-439b-8c1c-260a4c0eaba2",
"attribute": {
"id": "0cc8b653-8cf2-4b71-817f-f16c4311f3ee",
"object": "attribute",
"name": "Valor Restante",
"type": "number",
"default_data": 0,
"settings": {
"format": "custom",
"precision": 2,
"negative_numbers": false,
"currency": "$",
"customText": "R$",
"customPosition": "left"
},
"created_by": 156711,
"created_at": "2021-12-06T14:52:35.000000Z",
"deleted": false
},
"deleted": false
},
{
"id": "8cf95fe8-2a52-4ce0-8c78-546e988cb415",
"object": "value",
"data": 50,
"attribute_id": "ad1257eb-272b-4fc8-b5bc-828ce7d48b52",
"item_id": "2570a9d0-5e26-439b-8c1c-260a4c0eaba2",
"attribute": {
"id": "ad1257eb-272b-4fc8-b5bc-828ce7d48b52",
"object": "attribute",
"name": "Valor pago",
"type": "number",
"default_data": 0,
"settings": {
"format": "custom",
"precision": 2,
"negative_numbers": false,
"currency": "$",
"customText": "R$",
"customPosition": "left"
},
"created_by": 156711,
"created_at": "2021-12-06T22:42:05.000000Z",
"deleted": false
},
"deleted": false
},
{
"id": "fb72cef8-a3f8-4aaa-8d52-7474fe5cbd41",
"object": "value",
"data": 399,
"attribute_id": "d19a3301-a950-4db4-a999-aa22fe22db6c",
"item_id": "2570a9d0-5e26-439b-8c1c-260a4c0eaba2",
"attribute": {
"id": "d19a3301-a950-4db4-a999-aa22fe22db6c",
"object": "attribute",
"name": "Total $",
"type": "number",
"default_data": 0,
"settings": {
"format": "custom",
"precision": 2,
"negative_numbers": false,
"currency": "$",
"customText": "R$",
"customPosition": "left"
},
"created_by": 156711,
"created_at": "2021-12-06T22:41:46.000000Z",
"deleted": false
},
"deleted": false
},
{
"id": "5de345ee-d325-4c03-b624-c30897f2c4c1",
"object": "value",
"data": "2021-12-15",
"attribute_id": "8c4cffa7-c20c-481a-abaa-15513882f18d",
"item_id": "2570a9d0-5e26-439b-8c1c-260a4c0eaba2",
"attribute": {
"id": "8c4cffa7-c20c-481a-abaa-15513882f18d",
"object": "attribute",
"name": "Prazo de entrega",
"type": "date",
"default_data": null,
"settings": {
"format": "DD/MM/YYYY",
"include_time": false,
"time_format": "24"
},
"created_by": 156711,
"created_at": "2021-12-04T23:24:21.000000Z",
"deleted": false
},
"deleted": false
},
{
"id": "83124107-fd31-408a-87dc-981ad8c697dd",
"object": "value",
"data": [
"dd24ac7c-a995-49c1-a65f-23c30f9a9962"
],
"attribute_id": "2789aa51-aa0c-4862-8284-c2ccb09db236",
"item_id": "2570a9d0-5e26-439b-8c1c-260a4c0eaba2",
"attribute": {
"id": "2789aa51-aa0c-4862-8284-c2ccb09db236",
"object": "attribute",
"name": "Pagamento",
"type": "label",
"default_data": [
],
"settings": {
"multiple": false,
"allowNew": true,
"allowEmpty": true,
"labels": [
{
"id": "dd24ac7c-a995-49c1-a65f-23c30f9a9962",
"name": "Pago (Total)",
"color": "#B3EC8D"
},
{
"id": "3a07e0eb-ab30-4045-af12-045e9041e107",
"name": "Sinal pago + Restante na entrega",
"color": "#A7E6FF"
},
{
"id": "00337183-787f-4562-9857-fd8f1d0e9579",
"name": "Pagamento total na entrega",
"color": "#FFD3F2"
},
{
"id": "570e3c12-17ae-4e65-a171-2f65a6507510",
"name": "Em conta do cliente",
"color": "#ECD58D"
},
{
"id": "d6f63f32-f70e-4c85-aa28-d6a5e878af76",
"name": "Pagamento parcial + Restante em conta",
"color": "#FFB186"
}
]
},
"created_by": 156711,
"created_at": "2021-12-05T20:50:05.000000Z",
"deleted": false
},
"deleted": false
},
{
"id": "a6c13d14-e740-4404-876e-5b6d66c72a52",
"object": "value",
"data": [
"cc40109e-80bb-4f7b-b48e-9d245ad34577"
],
"attribute_id": "3bf38f8b-a0c2-4ae1-90cb-18451ac50a5a",
"item_id": "2570a9d0-5e26-439b-8c1c-260a4c0eaba2",
"attribute": {
"id": "3bf38f8b-a0c2-4ae1-90cb-18451ac50a5a",
"object": "attribute",
"name": "Status (Gráfica)",
"type": "label",
"default_data": [
"cc40109e-80bb-4f7b-b48e-9d245ad34577"
],
"settings": {
"multiple": false,
"allowNew": true,
"allowEmpty": false,
"labels": [
{
"id": "948d258d-07d9-4645-a662-9d71a3d1788d",
"name": "Orçamentos",
"color": "#A2ECC7"
},
{
"id": "cc40109e-80bb-4f7b-b48e-9d245ad34577",
"name": "Pendência",
"color": "#DADADA",
"textColor": "var(--label-color-text-dark)"
},
{
"id": "ce08c7b7-ab80-4547-ad77-2f784e91e9db",
"name": "Montar arte",
"color": "#A7E6FF"
},
{
"id": "80201aa7-e980-4273-94ce-def2b97e59a2",
"name": "Arte Montada",
"color": "#A52C94",
"textColor": "var(--label-color-text-light)"
},
{
"id": "c5c71b96-bdfd-4929-a5c1-4888e5ae6161",
"name": "Lote Impressão",
"color": "#BCD4F4"
},
{
"id": "a4e6930a-9e72-4926-a8d1-24f1b6b894f9",
"name": "Impresso",
"color": "#6888F3"
},
{
"id": "2df568fd-ba87-4ca9-bb10-b78b5a1b0446",
"name": "Galpão - (Material aguardando)",
"color": "#D6C2FF"
},
{
"id": "36d696f7-f038-4cf3-9afc-a687737dfde3",
"name": "Galpão - (Conferido)",
"color": "#FFD3F2"
},
{
"id": "e410f08b-854d-403a-8d5b-9f1bea50d6a7",
"name": "Galpão - (Finalizado)",
"color": "#7B52EC",
"textColor": "var(--label-color-text-light)"
},
{
"id": "c9b1f96f-941d-4e1a-8828-799951f6d276",
"name": "Aguardando Retirada (Na Gráfica)",
"color": "#FFA2A2"
},
{
"id": "0cda7641-7501-4fd5-8d14-33b5f353bfd4",
"name": "Entregue ao cliente",
"color": "#B3EC8D"
},
{
"id": "6a78f3cb-72ca-49cd-b265-5b3e2cb93eef",
"name": "Cancelado",
"color": "#000000",
"textColor": "var(--label-color-text-light)"
}
]
},
"created_by": 156711,
"created_at": "2021-12-02T17:33:39.000000Z",
"deleted": false
},
"deleted": false
},
{
"id": "e8176bac-f1ef-490c-87aa-ec349cf07b2e",
"object": "value",
"data": "Impressão Adesivo M² Fosco<BR><BR><BR><BR><BR>",
"attribute_id": "aca5d06c-508e-4441-8273-4e55262eeca5",
"item_id": "2570a9d0-5e26-439b-8c1c-260a4c0eaba2",
"attribute": {
"id": "aca5d06c-508e-4441-8273-4e55262eeca5",
"object": "attribute",
"name": "Descrição",
"type": "longtext",
"default_data": "",
"settings": {
},
"created_by": 12,
"created_at": "2021-11-29T00:51:40.000000Z",
"deleted": false
},
"deleted": false
}
],
"deleted": false
}
]

I put a function node to organize the best data

return Object.entries(items[0].json.values).map(([key, value]) => {
  return {
    json: value
  }
})

but I can’t get out of it


would need the data to come out as:

“id”: “data”
Example: “034783d5-738f-44ae-a1d0-7f2956860e81”: “c1966552301122185157”

or return only the “attribute” data

I’m sorry, my knowledge is still very basic, could you help me?
Thank you very much

Just a quick thought, have you tried adding an item list node after that and telling it to only give you attribute?

2 Likes

tried, but the data ends up mixed.

I will try to explain better what I am trying to do and what is happening.

retorno
the information I need to be in the [Item: 8]> [data]

image

and
attribute “name”: “Pagamento”
retorno2

the problem happens that sometimes when it returns this data the information is no longer in [Item: 8] sometimes it is in [Item: 0], [Item: 2]

When this happens I get the wrong data

I got a solution with multiple nodes to identify which [item] the data is in, and get the correct data, but is there a simple way to do this?