Because of the recent processing of some JSON data format, the early morning after a search, finally found the JQ this great tool. JQ allows you to manipulate JSON directly at the command line, including sharding, filtering, transformations, and so on.First install JQ under
Because some JSON data formats are to be processed recently, after some searches, we finally found jq, a great tool. Jq allows you to operate JSON directly on the command line, including sharding, filtering, conversion, and so on.
Let's use several examples to illustrate jq's functions:
Beautiful print
If we use a text
Before the command line to print JSON is all cat, and then copy the results to the editor supporting JSON resolution, very tortuous.
After a short search, an article was found on the StackOverflow. The highest support for the answer requires python2.6+ support, but the server version of 2.4, the impact of the upgrade is unpredictable, and then give up.
Continue to see the following answer, there is a smal
Use jq-friendly JSON printing skills in Linux and linuxjqjson skills
Previously, Cat was used to print JSON under the command line, and the results were copied to the editor supporting JSON parsing.
After a simple search, I found an article on StackOverflow. The answer with the highest support rating needs Python2.6
PrefaceIn an automated deployment involving shell scripts requires dynamic reading of many configuration files, preferably in JSON format.More JQ information: http://stedolan.github.io/jq/manual/First, the value is obtained by keySyntax:jq '. Key '1, single value acquisitionCat ' . Sign ' " d25341478381063d1c76e81b3a52e0592a7c997f "2.
JQ is a very handy JSON parser under Linux, and it is very inappropriate to read JSON files that are mixed in one line at a glance.https://stedolan.github.io/jq/download/Download it directly to the official website and run it like a normal program.1. The most common usage is./jq
When developing restful web apis, JSON is generally used as the format for returning data, and debugging using the Curl command is very convenient.But the problem with curl is that the JSON packets that are returned are not formatted, are not conducive to reading, and are more catastrophic when the data is Complex.At this time a lot of people use Postman with UI tools, I personally prefer curl, so found aJS
Jq submits post json data to webApi, jqwebapipostjson
When thinking about webApi post json data on the page, we found that webapi cannot directly accept data in json format (Note: I didn't find a good way to post json data ); however, it can be transmitted in a data structur
vararrcomlist; Try { //the data format passed in by the interface is A,b,c,d, where the array is returned by commas. Arrcomlist = Weighcontrol.getcomlist (). Split (', '); } Catch(e) {}vars = ""; //loops convert the array to JSON format. for(vari = 0; i ) { if(S.length > 0) {s + = "," }; S+ = "{\" id\ ":" + i + ", \" text\ ": \" "+ arrcomlist[i] +" \ "}"; } s= Eval ("[" + S + "]"); //assigning
Webpage JQ-based jq-hidden and display special effects, jq-based jq-Special Effects
The simple code for hiding and displaying JQ is as follows:
Copy the above Code and repeat it by yourself. Make a little progress every day.
Easy to forget, various jq selectors, missing, jq selectors
$ ("P"). addClass (style type defined in css); add a style to an element$ ("Img"). attr ({src: ”test.jpg ", alt:" test Image "}); add attributes/values to an element. The parameter is map.((“Img”).attr("“src”, ”test.jpg "); add attributes/values to an element$ ("Img"). attr ("title", function () {return this. src}); add attributes/values to an elem
Previously, I used Native JS to achieve a similar drag-and-drop div effect. Now I want to transform it into a small JQ plug-in based on the original idea and use it as a small exercise for making JQ plug-ins, if you are interested, you can find out that you haven't updated your blog for a while, but you don't know what you are busy with or how you are learning.
Learn to write the
Jq method, attributes, jq method attributes
1. jq change () event
When the element value changes, a change event occurs. This event is only applicable to text fields, textarea, and select.
When applicable to select elements, the change event will occur when an option is selected. When applicable to text or textarea, the change event will be triggered when the
Previously, I used Native JS to achieve a similar drag-and-drop div effect. Now I want to transform it into a small JQ plug-in based on the original idea and use it as a small exercise for making JQ plug-ins, if you are interested, you can find out that you haven't updated your blog for a while, but you don't know what you are busy with or how you are learning.
Learn to write the
Jq removes the webpage scroll bar and jq removes the scroll bar.
Sometimes the page needs to be able to scroll, but I don't want a scroll bar. I wrote a vertical scroll bar using jq.
Pure css can also be implemented
.box::-webkit-scrollbar{display:none}
However, edge is not compatible with Firefox. If you want to listen to scroll wheel events, it should be very e
Switching between the left and right focus charts based on images with excellent jq smoothness, and jq Smoothness
Today, we will share with you a left-side focus chart based on a picture with excellent jq smoothness. This is a jQuery-based download that supports mouse dragging and switching jQuery special effects. As follows:
Download Online Preview source code
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.