Jump to content
Fivewin Brasil

Ler Json


cendon

Recommended Posts

Boa noite Srs, estou tentando ler um retorno em Json, não estou conseguindo.

Tentei apenas converter com o hb_JSONDecode e mostrar no xbrowse

tentei tbm ler uma tabela multidimensional tbm não obtive sucesso, algum santo para me dar uma ajuda?

abaixo o fonte

Function Aj_decode()

local resultado, Aarray 

TEXT INTO resultado 
{
  "status": "success",
  "message": [
    {
      "simpleDebitoPayment": {
        "id": "0000007112022",
        "payerName": "ALLYSON CIRINO PEREIRA DA SILVA",
        "amount": 15.00,
        "scheduledDate": "2022-11-24T10:21:50.132",
        "payerDocument": 1452034680,
        "beneficiaryDocument": 13102672000150,
        "description": "DEBITO SEGURO",
        "bank": 33,
        "branch": "3476",
        "account": "2017801",
        "branchDigit": "2",
        "accountDigit": "9"
      },
      "valid": false,
      "errors": [
        {
          "message": "P0001: Err284: Payment 0000007112022 Already Exists in 1185"
        }
      ]
    },
    {
      "simpleDebitoPayment": {
        "id": "0000009112022",
        "payerName": "RAIKA LUANA FERREIRA MARTINS",
        "amount": 15.00,
        "scheduledDate": "2022-11-24T10:21:50.132",
        "payerDocument": 11754817696,
        "beneficiaryDocument": 13102672000150,
        "description": "DEBITO SEGURO",
        "bank": 237,
        "branch": "3728",
        "account": "510767",
        "branchDigit": "1",
        "accountDigit": "9"
      },
      "valid": false,
      "errors": [
        {
          "message": "P0001: Err284: Payment 0000009112022 Already Exists in 1185"
        }
      ]
    },
    {
      "simpleDebitoPayment": {
        "id": "0000010112022",
        "payerName": "CLEITON HONORIO DE OLIVEIRA",
        "amount": 15.00,
        "scheduledDate": "2022-11-24T10:21:50.132",
        "payerDocument": 7825483936,
        "beneficiaryDocument": 13102672000150,
        "description": "DEBITO SEGURO",
        "bank": 341,
        "branch": "2776",
        "account": "23893",
        "branchDigit": "6",
        "accountDigit": "9"
      },
      "valid": false,
      "errors": [
        {
          "message": "P0001: Err284: Payment 0000010112022 Already Exists in 1185"
        }
      ]
    }
  ]
}
endtext


x1 := hb_jsonDecode( resultado, @aArray )
IF aArray == nil
    MsgStop( "Erro ao retornar os dados. Tente novamente." )
     RETURN NIL
ENDIF
    
xbrowse(Aarray)

return

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...