You are viewing archived messages.
Go here to search the history.

dnmfarrell 2021-12-29 19:51:34

I wrote a tutorial for jp my bash-based json processor. https://github.com/dnmfarrell/jp#tutorial

I'm trying to make it easy for newcomers to learn something useful and accomplish something right away (even if the Venn diagram of users with bash who need to validate/transform json and don't already use jq is small). I'd appreciate any feedback anyone has. Thanks!

Tom Larkworthy 2021-12-30 19:42:57

Looks interesting, but hard for me to figure out how to program it. I prefer functional abstractions, Modeling a stack in my head feels inherently difficult to learn. Most JSON transforms I want to do is to flatten and pack things. I dunno how to do that. I look at map with fear. I don't think it can handle what I would want it for.

📷 image.png

dnmfarrell 2021-12-31 13:47:32

Hey thanks for taking a look. I agree, the stack concept is more abstract than passing explicit arguments. Do you have an example json transformation I could try? I'm curious if jp is missing a feature or if there is a use case it doesn't serve.

Tom Larkworthy 2021-12-31 19:38:58

OK here is my last usages of jq

gcloud container images list-tags eu.gcr.io/endpointservice/serversidecells \

    --project=endpointservice --limit 1 --format=json | jq '.[0].tags[0]' --raw-output



which is '.[0].tags[0]' against:

[

  {

    "digest": "sha256:7c470e2220c6e3160b88d88db9dc5bd121203e7bd2a734bda2a43d7af0277a0c",

    "tags": [

      "20211217_143425"

    ],

    "timestamp": {

      "datetime": "2021-12-17 14:36:54+01:00",

      "day": 17,

      "fold": 0,

      "hour": 14,

      "microsecond": 0,

      "minute": 36,

      "month": 12,

      "second": 54,

      "year": 2021

    }

  }

]
Tom Larkworthy 2021-12-31 19:39:33

so i am really just reading first tags value via some kind of path based index

Jamshid 2021-12-31 23:02:43

Our work and the community I am running for the past 7 years got featured in this article by MIT Technology Review: https://www.technologyreview.com/2021/12/30/1043133/afghanistan-coding-bootcamp/