Skip to content

JSONPath example is invalid on Windows #9606

@itowlson

Description

@itowlson

This is a...

  • Feature Request
  • Bug Report

Problem:

The page https://kubernetes.io/docs/reference/kubectl/jsonpath/ gives the following as an example of JSONPath usage:

kubectl get pods -o=jsonpath='{range .items[*]}{.metadata.name}{"\t"}{.status.startTime}{"\n"}{end}'`

When I paste this into a Windows command prompt, I get the error error: error parsing jsonpath '{range, unclosed action.

Proposed Solution:

On Windows, you need to use double quotes around JSONPaths with spaces in them. This in turn means you need to use a single quote or an escaped double quote around literals:

kubectl get pods -o=jsonpath="{range .items[*]}{.metadata.name}{'\t'}{.status.startTime}{'\n'}{end}"
kubectl get pods -o=jsonpath="{range .items[*]}{.metadata.name}{\"\t\"}{.status.startTime}{\"\n\"}{end}"

Page to Update:
https://kubernetes.io/docs/reference/kubectl/jsonpath/

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions