Dasel
v2
v2
  • Introduction
  • GitHub
  • Supported file formats
  • Memory usage
  • Installation
  • Commands
    • Select
    • Put
    • Delete
  • Functions
    • Selector Overview
    • All
    • And
    • Append
    • Count
    • Equal
    • Filter
    • FilterOr
    • First
    • Index
    • Join
    • Key
    • Keys
    • Last
    • Len
    • LessThan
    • MapOf
    • Merge
    • MoreThan
    • Not
    • Or
    • OrDefault
    • Parent
    • Property
    • String
    • Null
    • This
    • Type
  • Examples
    • Using dasel as a go package
    • Basics
    • Change file format
    • Filtering objects based on present/missing key
Powered by GitBook
On this page
Edit on GitHub
  1. Functions

Key

Key expect no arguments.

It returns the key of the current value, where the key is the object property or array index used to access it.

Example

$ echo '{
  "list": ["x", "y", "z"],
  "object": {
    "a": "x",
    "b": "y",
    "c": "z"
  }
}' | dasel -r json 'all().all().key()'
0
1
2
"a"
"b"
"c"
PreviousJoinNextKeys

Last updated 2 years ago