Exemplo de fluxo para ler array de um Json
-
Boa tarde pessoal, tenho um Json de aplicação que possui alguns array na qual não estou conseguindo pegar para salvar em uma tabela.
Já consegui pegar o resource e as tag's, porém não sei como trabalhar com o "input_movimentations", maximo que consegui foi salvar em uma variável.
Alguem tem algum exemplo de fluxo para o Json abaixo?
Json:
{
"resource": {
"id": 698105,
"code": "AP587",
"date": "2024-02-06",
"end_date": "2024-02-11",
"status": "sought",
"closed_date": null,
"created_at": "2024-02-05T16:20:52.000-03:00",
"updated_at": "2024-02-05T16:23:33.000-03:00",
"observations": null,
"reopened_reference_id": null,
"retroactive": false,
"charge": {
"id": 18080,
"name": "Vinicius Sobral",
"username": "sobral788",
"email": "[email protected]",
"crea": null
},
"activity_type": {
"id": 10,
"name": "1ª Fungicida+Inseticida"
},
"responsible": {
"id": 9186,
"name": "Everson José Glatz",
"username": "everson.glatz",
"email": "[email protected]",
"crea": ""
},
"input_movimentations": [
{
"input_id": 54863,
"storage_id": 290,
"value": 10,
"kind": "removed",
"unit": "l",
"datetime": "2024-02-03T14:17:01.000-03:00",
"batch_info": {
"batch_id": null,
"validity": null,
"batch_number": null
}
},
{
"input_id": 21183,
"storage_id": 290,
"value": 740,
"kind": "removed",
"unit": "kg",
"datetime": "2024-02-03T14:17:01.000-03:00",
"batch_info": {
"batch_id": null,
"validity": null,
"batch_number": null
}
},
{
"input_id": 189085,
"storage_id": 290,
"value": 60,
"kind": "removed",
"unit": "kg",
"datetime": "2024-02-03T14:17:01.000-03:00",
"batch_info": {
"batch_id": null,
"validity": null,
"batch_number": null
}
},
{
"input_id": 180222,
"storage_id": 290,
"value": 15,
"kind": "removed",
"unit": "kg",
"datetime": "2024-02-03T14:17:01.000-03:00",
"batch_info": {
"batch_id": null,
"validity": null,
"batch_number": null
}
},
{
"input_id": 38275,
"storage_id": 290,
"value": 30,
"kind": "removed",
"unit": "kg",
"datetime": "2024-02-03T14:17:01.000-03:00",
"batch_info": {
"batch_id": null,
"validity": null,
"batch_number": null
}
},
{
"input_id": 194951,
"storage_id": 290,
"value": 60,
"kind": "removed",
"unit": "l",
"datetime": "2024-02-03T14:17:01.000-03:00",
"batch_info": {
"batch_id": null,
"validity": null,
"batch_number": null
}
}
]
},
"event": "created"
} -
Boa tarde pessoal, tenho um Json de aplicação que possui alguns array na qual não estou conseguindo pegar para salvar em uma tabela.
Já consegui pegar o resource e as tag's, porém não sei como trabalhar com o "input_movimentations", maximo que consegui foi salvar em uma variável.
Alguem tem algum exemplo de fluxo para o Json abaixo?
Json:
{
"resource": {
"id": 698105,
"code": "AP587",
"date": "2024-02-06",
"end_date": "2024-02-11",
"status": "sought",
"closed_date": null,
"created_at": "2024-02-05T16:20:52.000-03:00",
"updated_at": "2024-02-05T16:23:33.000-03:00",
"observations": null,
"reopened_reference_id": null,
"retroactive": false,
"charge": {
"id": 18080,
"name": "Vinicius Sobral",
"username": "sobral788",
"email": "[email protected]",
"crea": null
},
"activity_type": {
"id": 10,
"name": "1ª Fungicida+Inseticida"
},
"responsible": {
"id": 9186,
"name": "Everson José Glatz",
"username": "everson.glatz",
"email": "[email protected]",
"crea": ""
},
"input_movimentations": [
{
"input_id": 54863,
"storage_id": 290,
"value": 10,
"kind": "removed",
"unit": "l",
"datetime": "2024-02-03T14:17:01.000-03:00",
"batch_info": {
"batch_id": null,
"validity": null,
"batch_number": null
}
},
{
"input_id": 21183,
"storage_id": 290,
"value": 740,
"kind": "removed",
"unit": "kg",
"datetime": "2024-02-03T14:17:01.000-03:00",
"batch_info": {
"batch_id": null,
"validity": null,
"batch_number": null
}
},
{
"input_id": 189085,
"storage_id": 290,
"value": 60,
"kind": "removed",
"unit": "kg",
"datetime": "2024-02-03T14:17:01.000-03:00",
"batch_info": {
"batch_id": null,
"validity": null,
"batch_number": null
}
},
{
"input_id": 180222,
"storage_id": 290,
"value": 15,
"kind": "removed",
"unit": "kg",
"datetime": "2024-02-03T14:17:01.000-03:00",
"batch_info": {
"batch_id": null,
"validity": null,
"batch_number": null
}
},
{
"input_id": 38275,
"storage_id": 290,
"value": 30,
"kind": "removed",
"unit": "kg",
"datetime": "2024-02-03T14:17:01.000-03:00",
"batch_info": {
"batch_id": null,
"validity": null,
"batch_number": null
}
},
{
"input_id": 194951,
"storage_id": 290,
"value": 60,
"kind": "removed",
"unit": "l",
"datetime": "2024-02-03T14:17:01.000-03:00",
"batch_info": {
"batch_id": null,
"validity": null,
"batch_number": null
}
}
]
},
"event": "created"
}@leandromachado Bom dia.
Você pode está obtendo o valor da chave supracitada, e utilizar as funções da categoria
Listapara obter dos dados, como será um objeto JSON, você utilizará as funções pertinentes para obter e manipular os dados.Cordialmente.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Cadastrar Login