zoukankan      html  css  js  c++  java
  • 学习笔记之jq

    jq

    • https://stedolan.github.io/jq/
    • jq is a lightweight and flexible command-line JSON processor.
    • jq is like sed for JSON data - you can use it to slice and filter and map and transform structured data with the same ease that sedawkgrep and friends let you play with text.
    • jq is written in portable C, and it has zero runtime dependencies. You can download a single binary, scp it to a far away machine of the same type, and expect it to work.
    • jq can mangle the data format that you have into the one that you want with very little effort, and the program to do so is often shorter and simpler than you'd expect.
    • https://stedolan.github.io/jq/tutorial/
      • curl 'https://api.github.com/repos/stedolan/jq/commits?per_page=5' | jq '.'
      • curl 'https://api.github.com/repos/stedolan/jq/commits?per_page=5' | jq '.[0]'
      • jq '.[0] | {message: .commit.message, name: .commit.committer.name}'
      • curl 'http://...' | jq '.[] | "curl " + .url + "| jq .message > test.json"'
      • cat test.json | jq . > new.json
    • https://stedolan.github.io/jq/manual/

    How to install jq on linux system ?

    • Download jq-linux64 from jq (stedolan.github.io)
    • Put it under one directory in PATH, e.g. ~/bin
    • $ chmod +x jq-linux64
    • $ mv jq-linux64 jq
    • $ jq
    • $ echo '{"foo": 0}' | jq .
     
  • 相关阅读:
    Go:获取命令行参数
    Go:文件操作
    Go:类型断言
    GO:interface
    Go:面向"对象"
    Go:工厂模式
    layui中流加载layui.flow
    js显示当前时间
    layui中的分页laypage
    layui中的多图上传
  • 原文地址:https://www.cnblogs.com/pegasus923/p/13845186.html
Copyright © 2011-2022 走看看