Skip to content

Differentiate Keys from String Values #19

Open

Description

@rajadain

Hello,

Currently, JSON highlighting on GitHub does not differentiate keys from string values. For example, the following:

{
  "parentShape": "{\"type\":\"MultiPolygon\",\"coordinates\":[[[[-75.1626205444336,39.95580659996906],[-75.25531768798828,39.94514735903112],[-75.22785186767578,39.89446035777916],[-75.1461410522461,39.88761144548104],[-75.09309768676758,39.91078961774283],[-75.09464263916016,39.93817189499188],[-75.12039184570312,39.94435771955196],[-75.1626205444336,39.95580659996906]]]]}",
  "childShapes": [
    "{\"type\":\"MultiPolygon\",\"coordinates\":[[[[-75.1626205444336,39.95580659996906],[-75.25531768798828,39.94514735903112],[-75.22785186767578,39.89446035777916],[-75.1461410522461,39.88761144548104],[-75.09309768676758,39.91078961774283],[-75.09464263916016,39.93817189499188],[-75.12039184570312,39.94435771955196],[-75.1626205444336,39.95580659996906]]]]}",
    "{\"type\":\"MultiPolygon\",\"coordinates\":[[[[-75.1626205444336,39.95580659996906],[-75.25531768798828,39.94514735903112],[-75.22785186767578,39.89446035777916],[-75.1461410522461,39.88761144548104],[-75.09309768676758,39.91078961774283],[-75.09464263916016,39.93817189499188],[-75.12039184570312,39.94435771955196],[-75.1626205444336,39.95580659996906]]]]}",
    "{\"type\":\"MultiPolygon\",\"coordinates\":[[[[-75.1626205444336,39.95580659996906],[-75.25531768798828,39.94514735903112],[-75.22785186767578,39.89446035777916],[-75.1461410522461,39.88761144548104],[-75.09309768676758,39.91078961774283],[-75.09464263916016,39.93817189499188],[-75.12039184570312,39.94435771955196],[-75.1626205444336,39.95580659996906]]]]}"
  ],
  "streamLines": "{\"type\":\"MultiLineString\",\"coordinates\":[[[-75.1436574074125,39.9180092592633],[-75.1437500000051,39.9180092592633],[-75.1438425925977,39.9181018518559],[-75.1439351851903,39.9181944444485],[-75.1439351851903,39.918287037041]]]}",
  "operations": [
    {
      "type": "RasterGroupedCount",
      "rasters": [
        "nlcd-2011-30m-epsg5070-512-int8",
        "ssurgo-hydro-groups-30m-epsg5070-512-int8"
      ]
    },
    {
      "type": "RasterLinesJoin",
      "rasters": [
        "nlcd-2011-30m-epsg5070-512-int8"
      ]
    },
    {
      "type": "RasterGroupedCount",
      "rasters": [
        "us-groundwater-nitrogen-30m-epsg5070-512"
      ]
    },
    {
      "type": "RasterGroupedAverage",
      "targetRaster": "us-ssurgo-aws100-30m-epsg5070-512",
      "rasters": [
        "us-groundwater-nitrogen-30m-epsg5070-512"
      ]
    },
    {
      "type": "RasterGroupedCount",
      "rasters": [
        "nlcd-2011-30m-epsg5070-512-int8",
        "us-percent-slope-30m-epsg5070-512"
      ],
    },
    {
      "type": "RasterGroupedAverage",
      "targetRaster": "us-percent-slope-30m-epsg5070-512",
      "rasters": []
    },
    {
      "type": "RasterGroupedAverage",
      "targetRaster": "us-ssugro-kfactor-30m-epsg5070-512",
      "rasters": [
        "nlcd-2011-30m-epsg5070-512-int8"
      ]
    },
  ]
}

is very difficult to read. Here is what it looks like on my computer today:

image

Compare this to how it looks in, say, Atom:

image

The colors make a big difference.

After doing some research, I found this issue: github-linguist/linguist#3026 in the GitHub Linguist repo, and this final comment: github-linguist/linguist#3026 (comment) by @pchaigno recommended making an issue for this discussion here.

I would very much like to see colors like the above in GitHub when viewing JSON documents, and want to start that discussion. If this is not the appropriate place for it, please let me know where would be better and I'll make an issue there.

Thank you.

Activity

  1. apptomorrow commented on Aug 20, 2018

    @apptomorrow
    • 1
  2. TimidRobot commented on Apr 24, 2020

    @TimidRobot

    Until this is fixed, there are some workarounds documented here: How to style JSON block in Github Wiki? - Stack Overflow

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

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