Giter Club home page Giter Club logo

json-viewer's Introduction

JSONViewer Logo

JSON Viewer

screenshot

The most beautiful and customizable JSON/JSONP highlighter that your eyes have ever seen. It is a Chrome extension for printing JSON and JSONP.

Notes:

  • This extension might crash with other JSON highlighters/formatters, you may need to disable them
  • To highlight local files and incognito tabs you have to manually enable these options on the extensions page
  • Sometimes when the plugin updates chrome leaves the old background process running and revokes some options, like the access to local files. When this happen just recheck the option that everything will work again
  • Works on local files (if you enable this in chrome://extensions)

Features:

  • Syntax highlighting
  • 27 built-in themes
  • Collapsible nodes
  • Clickable URLs (optional)
  • URL does not matter (the content is analysed to determine if its a JSON or not)
  • Inspect your json typing "json" in the console
  • Hot word json-viewer into omnibox (type json-viewer + TAB and paste your JSON into omnibox, hit ENTER and it will be highlighted)
  • Toggle button to view the raw/highlighted version
  • Works with numbers bigger than Number.MAX_VALUE
  • Option to show line numbers
  • Option to customize your theme
  • Option to customize the tab size
  • Option to configure a max JSON size to highlight
  • Option to collapse nodes from second level + Button to unfold all collapsed nodes
  • Option to include a header with timestamp + url
  • Option to allow the edition of the loaded JSON
  • Option to sort json by keys
  • Option to disable auto highlight
  • Option for C-style braces and arrays
  • Scratch pad, a new area which you can type/paste JSON and format indefinitely using a button or key shortcut. To access type json-viewer + TAB + scratch pad ENTER

Installation

Install through Chrome Web Store

https://chrome.google.com/webstore/detail/json-viewer/gbmdgpbipfallnflgajpaliibnhdgobh

Or compile and load by yourself

  1. It depends on node (version in package.json engines).
  2. npm install --global yarn
  3. yarn install
  4. yarn run build
  5. Open Chrome and go to: chrome://extensions/
  6. Enable: "Developer mode"
  7. Click: "Load unpacked extension"
  8. Select: "build/json_viewer" directory.

Try it on

JSON

https://api.github.com/repos/tulios/json-viewer

http://graph.facebook.com/github

https//api.github.com

https://api.github.com/gists/public

Large files:

https://raw.githubusercontent.com/ebrelsford/geojson-examples/master/596acres-02-18-2014.geojson

https://api.takealot.com/rest/v-1-4-2/productlines?available=1&cat=10371&instock=1&rows=10&sort=score%20desc&start=0

JSONP

http://freemusicarchive.org/api/get/curators.jsonp?api_key=60BLHNQCAOUFPIBZ&callback=test

License

See LICENSE for more details.

json-viewer's People

Contributors

atilkan avatar benhollander avatar benvan avatar bluec0re avatar bobpiece avatar buster95 avatar chasewagoner avatar discotroll65 avatar eigilsagafos avatar elyscape avatar jkreileder avatar kyleladd avatar lottamus avatar micheleb avatar north101 avatar npejo avatar reimund avatar roth-michael avatar ssonal avatar tk-atlas avatar tulios avatar vkadam avatar vladimiralexiev avatar wednesday avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

json-viewer's Issues

Extension does not work for blob URLs

If I create an URL dynamically using URL.createObjectURL, the extension does not detect JSON when I navigate to it.

Test code:

var blob = new Blob(['{ "lastname": "Dresden", "occupation": "Wizard" }'], {type: 'application/json'});
var url = URL.createObjectURL(blob);
$('body').append($('<a>Link to a JSON blob</a>').attr({
    href: url,
    target: '_blank'
}));

See http://jsfiddle.net/fQKYb/.

Long numbers inside arrays

Extension doesn't render long numbers correctly.

Try 39977290059340801. In an object, it will be displayed correctly. In an array, it gets rounded down to 39977290059340800.

Support for 'json log files'

Can it also 'do mostly the same' for log files that are structured as a list of (newline delimited) json objects?

I can't imagine this will make the regular case buggy, only seems to require adapting the input size limit enforcement code I believe. Then it would be both a json viewer and json log viewer. Json log files are pretty standard at least in the node.js realm (default in popular node.js loggers) and they are more useful than text log files.

One way to get that is to turn the input from a sequence of (newline delimited) json objects to a parent json object that includes the original obejcts as an array of objects. A bit dirty as it needs to add a meaningless top level object name (e.g. named 'multiple objects' or something) but quite harmless. All that before passing on to the same display code.

?

Allow search outside of viewport

The JSON is highlighted just in the viewport area to allow larger files to be loaded and highlighted without delay, but I miss the fact that the search was impacted occurring just in the highlighted area. This must be fixed asap.

Request user documentation

It is not clear to me how to use this extension. Do you have instructions on how to load a JSON file? I typed in "json-viewer " in the text field for the Chrome browser. What do I type in next? What are the commands?

I would like to view a file on my file system. Do you have an example on how to do this?

How do I use Json Viewer in Chrome

I installed the extension, but I can't figure out anywhere how to actually view the JSON from a url. I'm new to coding, so I know this is probably a dumb question.

Show escaped strings as unescaped

Original json encoded source:

{"href":"\/some\/path\/here"} 

In extension this string looks escaped too, so I can't copy or click it. Please, show it as decoded.

Extension not working for large json file

Hi,

I have a large .json file (641KB) and I noticed that this application will not load it, under any circumstances. I really need to have a visual layout of this massive file and I thought your extension would be the best. I wouldn't mind sending you the file somewhere in private, but as it has information not meant to be completely public, I can't just post it here.

The file comes from a JSON.stringify() call in NodeJS and is valid according to http://www.freeformatter.com/json-validator.html and http://jsonlint.com/.

New Feature: Area to paste JSON

I find myself having to copy/paste JSON from places and it would be nice to have a section in the extension for doing this. You can do it currently by typing json-viewer + tab in the Omnibox, then pasting what you want and hitting enter, but having to type json-viewer every time is slow. There is also no way to make a nice bookmark out of it. Just a page in the extension that could be bookmarked, that simply has a big text area and a button that says "Format" would be nice.

UTF-8 Characters

Hi,

Congrats for this awesome extension.

One problem I have detected is that UTF-8 accentuation is not rendered normally and instead it is escaped as \uXXXX

ex:

{
  "s": [
    {
      "r": {},
      "q": "Quando voc\u00ea vai \u00e0 praia, costuma levar comes e bebes?",
      "t": "select",
      "fb": [],
      "fdata": {}
}]
}

I'm sending the correct encoding on response headers:
Content-Encoding:gzip
Content-Length:54119
Content-Type:application/json; charset=utf-8

Any hints?

screen shot 2014-08-13 at 10 56 12 am

Replace options with raw link/(un)collapse all

Right now, when viewing json files, in the right top corner there's a gear icon that links to the options. I can find those options through the extensions page as well (and honestly, I only configure those once, upon first usage), what would be more handy to see at every json file are more context-oriented links, like a link to a raw version of the json (not mangled by the extension) a link to collapse or uncollapse all nodes on the current json file etc.

Can't copy entire json

When I copy the json, the closed itens still closed in my text editor... So I got something like this:

{ "json1":
[...],
"json2":
[...]
}

Json Viewer settings accessible in any corner.

Will be amazing if we can access the settings clicking in an icon in top right corner, for example.

The icon settings can be activated by mouseover event, so the icon will not bother anyone.

Scroll to first hit while typing in search box

While I loved the new search introduced a while back, I'm really missing this feature, which the built-in Chrome search had, that scrolled to the first hit while typing in the search text box.

Keep up the good work! You plugin is amazing ๐Ÿ˜„

Option to skip JSON.parse to allow numbers bigger than Number.MAX_VALUE

JSON.parse was used to fix some encoding problems but it rounds numbers bigger than Number.MAX_VALUE. Some users have JSON files with numbers bigger than Number.MAX_VALUE (e.g. 80402000000790837 gets rounded to 80402000000790830) and it will be nice for them to have an option to skip JSON.parse and allow these kind of numbers (at least while I find a better way to handle the encode problem)

Custom search is changing values with the highlight marks

When you hit enter in the search field it changes some values, especially urls. Someone complained in chrome web store comments but it didn't provided any ways to reproduce the error or be contacted, I think that the reported error is caused by the search.

Search for com in test.json and it should be enough to reproduce the error.

screen shot 2015-07-28 at 23 28 11

Theme with smaller font size

I find the current themes waste too much space. Could you add a theme that is more compact with smaller font sizes? Ideally something that looks like GitHub.

Edit: Just realized you can customize font-size and font-face. Maybe just move the custom styling next to the theming :)

Show render time / download time / latency on header

Hi,

I have noticed that for large JSON files it takes a bit for rendering the JSON visualization.

It would be nice to show in the headers the actual time it took to download the JSON so we don't suspect of server issues.

Ex:

On a 53.1Kb JSON File, it took 1.15 sec for the download to take place of this particular JSON but the plugin kept spinning for about 6 seconds... It would be nice to know the actual time the server took to process it so I don't freak out about performance issues...

screen shot 2014-08-13 at 11 01 43 am

Error "Unexpected token E" when processing numbers with ExponentPart

When faced with a JSON document that is:

{
    "value": 8.4127988E8
}

A SyntaxError is reported

SyntaxError: Unexpected token E
    at Object.parse (native)
    at chrome-extension://gbmdgpbipfallnflgajpaliibnhdgobh/assets/viewer.js:1:1410
    at l (chrome-extension://gbmdgpbipfallnflgajpaliibnhdgobh/assets/viewer.js:1:2355)
    at p (chrome-extension://gbmdgpbipfallnflgajpaliibnhdgobh/assets/viewer.js:1:3532)
    at new a (chrome-extension://gbmdgpbipfallnflgajpaliibnhdgobh/assets/viewer.js:1:2589)
    at r (chrome-extension://gbmdgpbipfallnflgajpaliibnhdgobh/assets/viewer.js:1:1330)
    at chrome-extension://gbmdgpbipfallnflgajpaliibnhdgobh/assets/viewer.js:1:1008
    at o (chrome-extension://gbmdgpbipfallnflgajpaliibnhdgobh/assets/viewer.js:1:2305)
    at chrome-extension://gbmdgpbipfallnflgajpaliibnhdgobh/assets/viewer.js:1:2916
    at MutationObserver.r (chrome-extension://gbmdgpbipfallnflgajpaliibnhdgobh/assets/viewer.js:1:3929)(anonymous function) @ chrome-extension://gbmdgpbipfallnflgajpaliibnhdgobh/assets/viewer.js:1

and only a raw rendering of the document is shown. FYI, using JSON.parse(...) directly works fine:

> JSON.parse('{"value":8.4127988E8}')
Object {value: 841279880}

Using:

  • Version 0.9.2 of the extension
  • Chrome 44.0.2403.81 beta-m (64-bit) on Windows

read-only mode allows paste

From chrome web store, user Amanpreet Singh(TECH - BLR):

"You can paste content when in Read only mode by accident and there is no way to remove it.

I am using it in conjunction with clipboard recorder like alfred. When you select the content to search first of all custom search bar goes away and things gets pasted inside the Json View.

Also custom Search Bar should not go away while i am selection an item to paste. Default chrome search bar has this behaviour. I use CMD+CTRL+V to bring paste menu due to which Viewers custom search bar goes away."

Customizable whitespace

Expose indentUnit to allow users to configure their own space unit.

As requested in chrome web store:
"The extension could be great if we can use our own whitespace. Maybe 4 spaces or using tabs."

Count number

I would like to have the number of elements in a collection.

Collapse all nodes

Hold SHIFT and click in one node to collapse all others at the same level.

Add an option for C-style braces

Please add an option for C-style object and array braces.

Java-style (current):

{
    "foo" : {
        "bar" : 10
    },
    "lol" : [
        "rofl",
        "lmao"
    ]
}

C-style:

{
    "foo" :
    {
        "bar" : 10
    },
    "lol" :
    [
        "rofl",
        "lmao"
    ]
}

Parentheses in array

From Shuie Yankelewitz (chrome web store support)

"array data that has a parentheses immediately adjacent to text throws an error Error: contentExtractor: Unexpected token A"

No Good:

{"DATA":[[90,"ERROR(err)"]]}

Good:

{"DATA":[[90,"ERROR (err)"]]}

Preview / Raw buttons

Please, add two buttons beside settings button:

[ Preview ] [ Raw ]

First is enabled by default and show current view. Second will show original source.

Unexpected token d when parsing one-liner containing "1(2d)"

Sorry for the ultra-specific issue title, but this is some kind of extreme edge case parsing error that I just happened to stumble upon with some of our application data. After narrowing down and scrubbing the content, I was able to recreate this error:

Error: contentExtractor: Unexpected token c
    at chrome-extension://gbmdgpbipfallnflgajpaliibnhdgobh/assets/viewer.js:1:1964
    at a (chrome-extension://gbmdgpbipfallnflgajpaliibnhdgobh/assets/viewer.js:1:3181)
    at p (chrome-extension://gbmdgpbipfallnflgajpaliibnhdgobh/assets/viewer.js:1:4366)
    at new l (chrome-extension://gbmdgpbipfallnflgajpaliibnhdgobh/assets/viewer.js:1:3416)
    at r (chrome-extension://gbmdgpbipfallnflgajpaliibnhdgobh/assets/viewer.js:1:1735)
    at chrome-extension://gbmdgpbipfallnflgajpaliibnhdgobh/assets/viewer.js:1:1408
    at o (chrome-extension://gbmdgpbipfallnflgajpaliibnhdgobh/assets/viewer.js:1:3131)
    at chrome-extension://gbmdgpbipfallnflgajpaliibnhdgobh/assets/viewer.js:1:3746
    at MutationObserver.r (chrome-extension://gbmdgpbipfallnflgajpaliibnhdgobh/assets/viewer.js:1:4761)

using this content:

{"a":[{"b":{"c":"1(2d)"}}]}

What's odd though, is if I re-format the JSON in IntelliJ, then json-viewer parses it fine. Here's the re-formatted content that works:

{
    "a": [
        {
            "b": {
                "c": "1(2d)"
            }
        }
    ]
}

URL non clickable when there is no TLD in the domain name.

I working on a local network so we don't use TLD in the domain name for our servers. Therefore the url in our JSON do not contain a TLD.

It seems to be that you rely on that to make text clicable or not.

Imho this should be fixed :)

Disable integrated search

Could you please add an option to disable the integrated search? I know it supports regex, but sometimes the Chrome find command is just simpler to use / has better readability.

Font

Works as advertized :)
Can it also use the font shown on the settings page themes (I think it's called comic or something) rather than Chrome's default font? a thicker font is easier for 'glossing-and-fishing' which is what we typically do with json (we don't read json). (I'm a bit reluctant changing my default font in Chrome itself as I can't tell what that will also affect)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.