Skip to content

Help with json #105

Answered by TomWright
ghost asked this question in Q&A
Mar 21, 2021 · 2 comments · 2 replies
Discussion options

You must be logged in to vote

Hey @ws-way,

There are a few ways you could put this together - dasel lets you put strings, ints and bools one at a time or you can put entire documents.

The following will create the document for you. This is possible because dasel interprets the selectors and will create empty objects/arrays for you where possible.

echo '' | \
dasel put string -p json '.Comment' 'CREATE/DELETE/UPSERT a record' | \
dasel put string -p json '.Changes.[0].Action' 'UPSERT' | \
dasel put string -p json '.Changes.[0].ResourceRecordSet.Name' 'metrics.try.my.domain' | \
dasel put string -p json '.Changes.[0].ResourceRecordSet.Type' 'SRV' | \
dasel put int -p json '.Changes.[0].ResourceRecordSet.TTL' '300' | \
d…

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
2 replies
@link4531
Comment options

@TomWright
Comment options

Answer selected by TomWright
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #104 on March 22, 2021 09:15.