Created
June 14, 2018 08:04
-
-
Save DennisXie/e6f4a70ec8970d55294fa4e55e94b799 to your computer and use it in GitHub Desktop.
jq: list to object
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
问题: 使用jq将[{uid: 1, k1: v1, k2: v2}, {uid: 2, k1: v1, k2: v2}, ....]的list转换成 {'1': {k1: v1, k2: v2}, '2': {k1: v1, k2: v2},.....}这种形式 | |
jq: [.[] | {(.uid | tostring): {k1: .k1, k2: .k2}}] | add |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment