Giter VIP home page Giter VIP logo

safari-json-formatter's Introduction

JSON Formatter

A Safari extension which makes valid JSON documents human-readable.

Before:

Before

After:

After

Installation

Download the extension and open it with Safari 5.

Usage

Once installed, load any valid JSON document. This project's most recent commit makes a good example.

Version History

1.1

  • Added folding of arrays, objects and long strings
  • Added setting for auto-folding of long strings (default: on)
  • Added setting for "long string" threshold (default 512 bytes)
  • Added a "toggle formatting" button to switch between formatted and original JSON
  • Bug Fixes

Caveats

The extension aims to produce the same JSON string that's been loaded as input, but because the original JSON has actually been parsed, some transformation may occur. In other words, the formatted JSON will always be equivalent to the original JSON, but in rare circumstances it may not match exactly. The only known example of this is kind of discrepancy is between number formats -- if the original JSON contains the numeric value 1e2, for example, the formatted JSON will display the value 100.

safari-json-formatter's People

Contributors

bjhomer avatar daniels220 avatar rfletcher 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

safari-json-formatter's Issues

Collapse/Expand nodes

For extra viewing pleasure on large datasets it might come in handy to be able to collapse and expand nodes. Look at firefox plugin "jsonview" for inspiration ;)

Links aren't clickable

A good rest API usually includes links to other entities.

It would be nice if the links would be clickable, similar to JSONView on chromes extension.

JSONP support

JSON.parse fails if the response is JSONP ( e.g.: callback({ key: "value" }); ). This is correct, but inconvenient.

Even something simple like this would be nice (haven't tested, probably wrong):

var callback, json;
// [$A-Za-z_][0-9A-Za-z_]* is a valid JavaScript function name...
var matches = /\s*([$A-Za-z_][0-9A-Za-z_]*)\s*\((.*)\)/.exec( document.body.textContent );
if (matches) {
    callback = matches[1];
    json = matches[2];
} else {
    // no callback
    json = document.body.textContent;
}

Then format as you please.

Collapse All

Adding a Collapse All button or preference would immensely help me when working with huge JSON files where I only want to drill into one block of JSON or several nested blocks.

Thanks!

add sort cancel options

When retrieving big datasets (like CouchDB views at 500KB+) the sorting of the page is slowing down the whole system. Therefor I deactivated the automated sorting of this extension.

However it would be nice to see smaller results sorted.
What I would like to see, an option to cancel the automated sorting when a certain size is reached.

Async JSON call is written to browser window, replacing current DOM

Hi,

While signing up with typeform.com, the async JSON(P?) call they use to return signup success/failure status, comes up as a full window JSON output (like when your normally load up a JSON file with this plug-in loaded), overwriting whatever is on screen currently.

When I turn off the JSON formatter plug-in, the signup procedure on this website behaves as normal, i.e. modifying the DOM to display a success message.

JSONP?

It would be nice if this plugin could take JSON that is wrapped in a single function call, which is what is returned by JSONP calls. So this would get formatted:

name_of_function(
valid_JSON
)

The name_of_function has to allow an arbitrary identifier.

Extension causes certain websites to not render, instead showing JSON

This is the first time I've seen this bug, but it may not isolated to this website.

When I navigate here in Safari with the extension enabled, I am sent to a page containing the JSON for what I am guessing is the tab formatting instead of the article (image below).

Visiting that website in another browser or with the extension disabled shows me the article without any issues.

screen shot 2016-05-25 at 2 24 30 pm

No longer supported in Safari 12

"Safari no longer supports unsafe extensions.

“JSON Formatter” is no longer supported. You can find newer extensions reviewed by Apple in the App Store or Safari Extensions Gallery."

Display original utf-8 string

Hello, I'm a happy user with your safari extension.
I'm a iOS and django developer.
The django side will output JSON format to iOS side.
Your extension helps me a lot while checking the content django returned.

But currently, I have to check some JSON output with some UTF-8 Chinese string.
for example:
{"patientType": "\u9580\u8a3a"}
which should be
{"patientType": "門診"}

I have no idea how to solve this in an extension development.
But I hope one day I can use your extension for checking JSON with non-English content.
Thanks very much.

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.