textmate / json.tmbundle

TextMate support for JSON
122 stars 26 forks source link

Differentiate Keys from String Values #19

Open rajadain opened 6 years ago

rajadain commented 6 years ago

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: https://github.com/github/linguist/issues/3026 in the GitHub Linguist repo, and this final comment: https://github.com/github/linguist/issues/3026#issuecomment-229373469 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.

apptomorrow commented 6 years ago
TimidRobot commented 4 years ago

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