Created
December 22, 2023 08:26
-
-
Save titanjer/1baa544c0dd57b5e0bfb1eeac171c190 to your computer and use it in GitHub Desktop.
Dynamodb Marshall by JQ
This file contains hidden or 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
def marshall: | |
def m: | |
def to_string: {S:.}; | |
def to_number: {N:.|tostring}; | |
def to_boolean: {BOOL:.}; | |
def to_array: {L:.|to_entries|map(.value|m)}; | |
def to_object: {M:.|map_values(m)}; | |
def to_null: {NULL:true}; | |
if .|type=="string" then .|to_string | |
elif .|type=="number" then .|to_number | |
elif .|type=="boolean" then .|to_boolean | |
elif .|type=="array" then .|to_array | |
elif .|type=="object" then .|to_object | |
elif .|type=="null" then .|to_null | |
else . end; | |
.|map_values(m); |
Author
titanjer
commented
Dec 22, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment