How to take value values in JSON objects _jsonpath

Source: Internet
Author: User

========= method One: About the value of the JSON key---JsonPath

Take this code as an example:

String token1= Jsonpath.eval (Json.parseobject (HttpResponse), "$.access_token"). ToString ();

Parameter: Json.parseobject (HttpResponse) converted to JSON data

$.access_token JSON Path

Turns the Httpresoonse entity response data into a JSON object.

Dollar sign: $ represents the current JSON object.

So the meaning of this code is:

Convert the data of the entity response to a JSON object, get a current JSON object $, and then find the path to the key you need, you can get the value of the key, then the value can be encapsulated as a method-(method two parameters (1). Response data, 2. The path to the key in JSON) to take the JSON object value, the next time to take the value of the JSON object, the call can be called)

How to take value values in JSON objects _jsonpath

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.