Skip to content

[RFD] JSON output produced by --format should not prettify values #674

Description

@thaJeztah

I noticed this a couple of times, but didn't open an issue yet; when using the --format option on commands, and requesting json output, the values included in the output should output the raw values, not the formatted output as is used in other formats.

For example:

$ docker ps --format '{{json .}}' | jq . 
{
  "Command": "\"nginx -g 'daemon of…\"",
  "CreatedAt": "2017-11-07 13:30:41 +0100 CET",
  "ID": "6f02a463250c",
  "Image": "nginx:alpine",
  "Labels": "com.docker.swarm.task=,com.docker.swarm.task.id=gwbj2pzql8r6ovcyw2s61piyy,com.docker.swarm.task.name=myservice.1.gwbj2pzql8r6ovcyw2s61piyy,maintainer=NGINX Docker Maintainers <docker-maint@nginx.com>,com.docker.swarm.node.id=url9rx710g8azgnhpmpr9hqfl,com.docker.swarm.service.id=2plef0c7wdya64ball1an4u2j,com.docker.swarm.service.name=myservice",
  "LocalVolumes": "0",
  "Mounts": "",
  "Names": "myservice.1.gwbj2pzql8r6ovcyw2s61piyy",
  "Networks": "one",
  "Ports": "80/tcp",
  "RunningFor": "3 minutes ago",
  "Size": "0B",
  "Status": "Up 4 minutes"
}

The RunningFor, Size, and Status output should print the "raw" information as obtained from the container, and ID should show the un-truncated ID.

Perhaps not the best example, as RunningFor is a calculated value, but opening this for discussion.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions