SpringBot + Java - Dúvida

0 respostas
jsonrestjavaspring
J

Boa tarde!

Estou consumindo um webservice, que retorna essa tag _embedded. Quando vou fazer o consumo ele gera o seguinte erro:

Exception in thread “main” org.json.JSONException: A JSONArray text must start with ‘[’ at 1 [character 2 line 1]

Como posso realizar o consumo com esta tag _embedded? Existe uma forma de remover isso?

O retorno do webservice:

{
  "_embedded": {
    "user": [
      {
        "name": "Mario Quarto",
        "userCpf": [telefone removido],
        "balance": 89.66,
        "_links": {
          "self": {
            "href": "http://localhost:8080/user/4"
          },
          "user": {
            "href": "http://localhost:8080/user/4"
          }
        }
      },
      {
        "name": "Mario Quarto",
        "userCpf": [telefone removido],
        "balance": 89.66,
        "_links": {
          "self": {
            "href": "http://localhost:8080/user/8"
          },
          "user": {
            "href": "http://localhost:8080/user/8"
          }
        }
      },
      {
        "name": "Mario Quarto",
        "userCpf": [telefone removido],
        "balance": 89.66,
        "_links": {
          "self": {
            "href": "http://localhost:8080/user/12"
          },
          "user": {
            "href": "http://localhost:8080/user/12"
          }
        }
      },
      {
        "name": "Mario Quarto",
        "userCpf": [telefone removido],
        "balance": 89.66,
        "_links": {
          "self": {
            "href": "http://localhost:8080/user/16"
          },
          "user": {
            "href": "http://localhost:8080/user/16"
          }
        }
      },
      {
        "name": "Mario Quarto",
        "userCpf": [telefone removido],
        "balance": 89.66,
        "_links": {
          "self": {
            "href": "http://localhost:8080/user/20"
          },
          "user": {
            "href": "http://localhost:8080/user/20"
          }
        }
      },
      {
        "name": "Mario Quarto",
        "userCpf": [telefone removido],
        "balance": 89.66,
        "_links": {
          "self": {
            "href": "http://localhost:8080/user/24"
          },
          "user": {
            "href": "http://localhost:8080/user/24"
          }
        }
      },
      {
        "name": "Mario Quarto",
        "userCpf": [telefone removido],
        "balance": 89.66,
        "_links": {
          "self": {
            "href": "http://localhost:8080/user/28"
          },
          "user": {
            "href": "http://localhost:8080/user/28"
          }
        }
      },
      {
        "name": "Mario Quarto",
        "userCpf": [telefone removido],
        "balance": 89.66,
        "_links": {
          "self": {
            "href": "http://localhost:8080/user/32"
          },
          "user": {
            "href": "http://localhost:8080/user/32"
          }
        }
      }
    ]
  },
  "_links": {
    "self": {
      "href": "http://localhost:8080/user/search/listcpf?userCpf=[telefone removido]"
    }
  },
  "page": {
    "size": 20,
    "totalElements": 8,
    "totalPages": 1,
    "number": 0
  }
}
Criado 22 de novembro de 2016
Respostas 0
Participantes 1