Skip to content

Latest commit

 

History

History
99 lines (68 loc) · 1.17 KB

jsonrange.md

File metadata and controls

99 lines (68 loc) · 1.17 KB

Using jsonrange

Working with a map

    echo '{"name": "Doe, Jane", "email":"[email protected]", "age": 42}' \
       | jsonrange

This would yield

    name
    email
    age

Using the -values option on a map

    echo '{"name": "Doe, Jane", "email":"[email protected]", "age": 42}' \
      | jsonrange -values

This would yield

    "Doe, Jane"
    "[email protected]"
    42

Working with an array

    echo '["one", 2, {"label":"three","value":3}]' | jsonrange

would yield

    0
    1
    2

Using the -values option on the same array

    echo '["one", 2, {"label":"three","value":3}]' | jsonrange -values

would yield

    one
    2
    {"label":"three","value":3}

Checking the length of a map or array or number of keys in map

    echo '["one","two","three"]' | jsonrange -length

would yield

    3

Check for the index value of last element

    echo '["one","two","three"]' | jsonrange -last

would yield

    2

Limitting the number of items returned

    echo '[1,2,3,4,5]' | jsonrange -limit 2

would yield

    1
    2