Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use JSONPath and JSON Lines

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article mainly introduces "how to use JSONPath and JSON Lines". In daily operation, I believe many people have doubts about how to use JSONPath and JSON Lines. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts about "how to use JSONPath and JSON Lines"! Next, please follow the editor to study!

A brief introduction

JSONPath:

A simple DSL query language that can be used to quickly parse specific values in JSON documents

JSON Lines:

UTF-8 coding

One JSON string per line

Line Separator can be'\ r\ n' of windows

It can also be'\ n'of Unix.

The general file suffix is .jsonl

What can it be used for? JSONPath

IDEA already supports JSON parsing, formatting, and beautification.

JSONPath can help developers quickly find values in a large JSON document without looking at them line by line.

If you use JSONPath variable strings in your code, you can use the Language injections function to quickly test whether your JSONPath is correct.

JSON Lines

Previously, IDEA was only supported by JSON/JSON5. When there are multiple JSON blocks in a JSON file, IDEA will prompt for errors, but it will not affect the use. Supporting jsonl is also a blessing for obsessive-compulsive disorder patients.

After testing, the JSONPath function of IDEA does not loop to parse JSON Lines files, so it seems to be useless. I look forward to the enhancement of the subsequent functions of IDEA.

How to quickly create a new JSON document using Scratch files

Scratch files is IDEA global (not bound with the currently open project), supports code hints, runs, debug code files, especially suitable for developers to quickly save a piece of code snippet, quickly test a piece of code, and so on.

You can create a new

File-> New-> Scratch File

Windows-Ctrl+Alt+Shift+Insert, macOS-⇧⌘ N, enter JSON on the keyboard and enter

Windows-Ctrl+Shift+A, macOS-⇧⌘ A, enter scratch file, and select JSON after entering enter

Embellishment after pasting JSON text [optional]

Windows-Ctrl+Alt+L, macOS-⌥⌘ L

Open the JSONPath toolbar

There are two ways to do this

Edit-> Find-> Evaluate JSONPath Expression...

Windows-Ctrl+Shift+A, macOS-⇧⌘ A, enter jsonpath, select Evaluate JSONPath Expression... Enter after

Take a value after entering a JSONPath expression

Expression syntax supports Goessner and Jayway

Click the small plus sign at the top of the toolbar to quickly add a custom JSON input. The disadvantage is that JSON will not be saved to the file, and it will be gone when tab is closed.

At this point, the study on "how to use JSONPath and JSON Lines" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report