Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
ed652ae
Edge compatibility
nicole-ashley Apr 20, 2017
c785633
Merge pull request #1 from nikrolls/edge-compatibility
nicole-ashley Apr 20, 2017
971ebe1
Added Gulp build system
nicole-ashley Apr 20, 2017
1f2888d
Merge pull request #2 from nikrolls/build-system
nicole-ashley Apr 20, 2017
a75ea52
Added basic theme support and did a substantial code cleanup
nicole-ashley Apr 20, 2017
f4b9d35
Merge pull request #3 from nikrolls/themes-and-cleanup
nicole-ashley Apr 20, 2017
ce5a681
Fixed a couple of build issues in gulpfile
nicole-ashley Apr 20, 2017
20ccc95
Fix font sizes in Chrome and hyperlink colours in dark theme
nicole-ashley Apr 20, 2017
9dbecbb
Added remainder of themes based on Ace Cloud Editor
nicole-ashley Apr 21, 2017
9ffe010
Merge pull request #4 from nikrolls/more-themes
nicole-ashley Apr 21, 2017
f9dbce0
0.8.0 release
nicole-ashley Apr 21, 2017
cf6fb2e
Improved colour transitions
nicole-ashley Apr 21, 2017
95188a7
Tooling around building releases
nicole-ashley Apr 21, 2017
6a1bc8c
Workaround for Chrome queuing transitions bug
nicole-ashley Apr 22, 2017
ede6c36
Parse text-only pages that have text/html mimetypes
nicole-ashley Apr 27, 2017
e233529
Merge pull request #5 from nikrolls/parse-plain-text-html-documents
nicole-ashley Apr 27, 2017
4bb4fd5
Release 0.8.3
nicole-ashley Apr 27, 2017
42d6a9c
Added line numbers
nicole-ashley May 2, 2017
c9797a7
Merge pull request #6 from nikrolls/line-numbers
nicole-ashley May 2, 2017
72d9484
0.9.0 release
nicole-ashley May 2, 2017
16e2ff6
Fix store links in Readme
nicole-ashley May 2, 2017
c20f089
Fixed build instructions
nicole-ashley May 2, 2017
562f721
Fixed Chrome extension link
nicole-ashley May 3, 2017
f51d096
Fixed doubled line numbers on empty objects and arrays
nicole-ashley May 5, 2017
1e7744f
Merge pull request #7 from nikrolls/fix-line-numbers-on-empty-objects…
nicole-ashley May 5, 2017
74a209c
Release 0.9.1
nicole-ashley May 5, 2017
a5c3675
Switched to tokenizer over browser parse
nicole-ashley May 8, 2017
4d4ee95
Merge pull request #8 from nikrolls/switch-to-tokenizer
nicole-ashley May 8, 2017
64eae22
Release 0.10.0
nicole-ashley May 8, 2017
afd0f57
Move to using WebExtension APIs for CSS injection
nicole-ashley Feb 4, 2018
c23e9cc
Add check and alert for larger JSON files
acupoftee Sep 28, 2019
eee7f4d
Refactored text length check
acupoftee Sep 28, 2019
a7587c1
Correct max length
acupoftee Sep 28, 2019
2714179
Add check for empty objects
acupoftee Sep 29, 2019
037fec3
Revert "Add check for empty objects"
acupoftee Sep 29, 2019
7700bce
Add check for empty objects and arrays
acupoftee Sep 29, 2019
e6fd5fd
Merge pull request #20 from acupoftee/empty-object-fix
nicole-ashley Sep 30, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
compass_app_log.txt
/dist/
/.idea/
/build/
/release/
/node_modules/
/.sass-cache/
19 changes: 19 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Copyright (c) 2017 Nik Rolls, Callum Lock

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
52 changes: 22 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
JSON Formatter
==============

Chrome extension for printing JSON and JSONP nicely when you visit it 'directly' in a browser tab.
Browser extension for printing JSON and JSONP nicely when you visit it 'directly' in a browser tab.

Features
--------

* JSONP support
* Fast, even on long pages
* Works on any valid JSON page – URL doesn't matter
* Syntax highlighting
* Syntax highlighting with 36 light and dark themes
* Collapsible trees, with indent guides
* Line numbers
* Clickable URLs
* Buttons for switching between raw and parsed JSON
* Parsed JSON is exported as a global variable, `json`, so you can inspect it in the console
Expand All @@ -20,39 +21,30 @@ A background worker is used to prevent the UI freezing when processing very long
Installation
------------

**Option 1** – just install it from the [Chrome Web Store](https://chrome.google.com/webstore/detail/bcjindcccaagfpapjjmafapmmgkkhgoa).
**Option 1** – Install it from the [Chrome Web Store](https://chrome.google.com/webstore/detail/mhimpmpmffogbmmkmajibklelopddmjf/) or [Windows Store](https://www.microsoft.com/en-us/store/p/json-formatter-for-edge/9nz9d2j86w6s).

**Option 2** – install it from source:
**Option 2** – Install it from source:

* clone/download this repo,
* open Chrome and go to `chrome://chrome/extensions/`,
* enable "Developer mode",
* click "Load unpacked extension",
* select the `extension` folder in this repo.
1. Clone/download this repo
2. Install dependencies using [NPM](https://nodejs.org/) or [Yarn](https://yarnpkg.com/en/).
3. Build the extension: `gulp build:dist`
4. Side-load the extension in your browser as per below

**Some URLs to try it on:**

* http://feeds.delicious.com/v2/json/popular?callback=hello
* http://gdata.youtube.com/feeds/api/standardfeeds/most_popular?alt=json&v=2
* http://twitter.com/statuses/public_timeline.json

FAQ
---

### Why are large numbers not displayed accurately?
Chrome

This is a [limitation of JavaScript](http://www.ecma-international.org/ecma-262/5.1/#sec-15.7.3.2) (and therefore JSON). The largest possible number is `Number.MAX_SAFE_INTEGER`, or **9007199254740991**. If you try to use a number larger than this in JavaScript/JSON, you'll lose accuracy.
5. Open Chrome and go to `chrome://chrome/extensions/`
6. Enable "Developer mode"
7. Click "Load unpacked extension"
8. Select the `build` folder created in step 3

The idea of JSON Formatter is to show you how the computer sees your JSON, so we don't attempt to circumvent this limitation, otherwise that would give a misleading representation of your data. It's better to see exactly what V8 sees.
Edge

If you want to use long sequences of digits in your JSON, then **quote them as strings**.
5. Open Edge and go to `about:flags`
6. Enable the option "Enable extension developer features" and restart the browser
7. Click on the ellipsis (...) menu, click "Extensions", and click "Load extension"
8. Select the `build` folder created in step 3

### Why are object keys sometimes in the wrong order?

What you see in JSON Formatter is a representation of the **parsed** object/array. You see what V8 sees.

Plain JavaScript objects are [unordered collections of properties](http://www.ecma-international.org/ecma-262/5.1/#sec-12.6.4). If you go through them with `for...in`, for example, there is no guarantee of any particular order. In practice, most engines maintain the order in which the keys were first declared, but V8 moves any numeric keys (e.g. `"1234"`) to the front, for a small performance gain. This was a [controversial issue](https://code.google.com/p/v8/issues/detail?id=164) – a lot of people think it sucks that you can't predict key enumeration order in Chrome – but the V8 team refused to 'fix' it, because it's not a bug, and they're right. If you want your values to be in a certain order, and you're relying on the non-standard key-ordering logic of a particular engine, then your code is broken. Restructure your data to use arrays.

##### But I just want it to be in order for readability
**Some URLs to try it on:**

That would require manually parsing the JSON string with regular expressions (instead of using `JSON.parse`), which would be too slow. And it's not a good idea to go down the road of representing the data differently from how the engine actually sees it.
* https://en.wikipedia.org/w/api.php?action=query&titles=Main%20Page&prop=contributors&format=json
* http://api.flickr.com/services/feeds/photos_public.gne?jsoncallback=jsonp&tags=json&tagmode=any&format=json
4 changes: 0 additions & 4 deletions config.rb

This file was deleted.

1 change: 0 additions & 1 deletion extension/css/content.css

This file was deleted.

Binary file removed extension/icons/128.png
Binary file not shown.
Binary file removed extension/icons/32.png
Binary file not shown.
Loading