Created
February 8, 2019 13:47
-
-
Save Koriit/f38c1c6ef89dde6fec0cea3af5d36708 to your computer and use it in GitHub Desktop.
To camel case function for JQ
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
def to_camel_case: . | ascii_downcase | split("_") | .[0:1] as $first | .[1:] | map(.[1:] as $rest | .[0:1] | ascii_upcase | . + $rest) | $first + . | join(""); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
A somewhat shorter solution:
A longer, but more readable solution: