Working with JSON online

Source: Internet
Author: User

Cause

Receive a query, export user account mapping another platform user name password work.

At first glance is not suitable for writing program implementation, because it is a temporary and unique task, to define a task suitable for writing a program to achieve depends on two points:

    1. Whether it is a recurring task
    2. is time-consuming for programming more than manual processing

If it is repetitive task to use program implementation, once and for all, but if the implementation of a simple implementation is very complicated, it is worth to consider whether it is worthwhile to do, and if it is a temporary task, only one time, it is basically manual operation can be, but some of the links can do some tools to do. That's the way I'm doing this time.

Demand

One step is to extract the user name from the JSON data in the query and configure the mapped user name password uniformly, with the following data format:

{    "OK":true,    "Data":{        "Page":0,        "Size": -,        "Content":[            {                "id":1,                "User":{                    "username":"Test 1",                    "Phone":"11111111111"                },                "CreateDate":"2020-12-23"            },            ...        ]    }}

In this JSON data to extract the username and output by the format can be, this time you can consider the implementation of the tool, the implementation of a lot of methods, I use JS to achieve a, with the interface to operate a little easier,

    1. Enter Raw JSON
    2. Define extraction rules (separated by "/" as paths, arrays using "*")
    3. Define the output template (the extracted content is replaced with the variable "$xx")
    4. Click Process and copy, in the output content is processed data, and has been copied
Realize
    1. Convert the input JSON string to a JSON object
    2. According to the rules of circular parsing, the recursive implementation of the loop, the "*" in the rules to do a special treatment
    3. Take the end of the rule to replace the "$xx" in the template and log it to the output
    4. Finally, it outputs all the content and uses the JS code to make the selection-copy.
      The code is too long to put, put a tool link, there is a need to see the source code on the line.
      Online JSON processing gadget
Recommend

Jane Page--Jane from the Heart, the page by oneself

Working with JSON online

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.