Code Monkey home page Code Monkey logo

json-viewer's Issues

Showing the viewer causes "access violation" for some arrays

NPP serves a "PluginsManager::runPluginCommand Exception" dialog containing only an "Access violation" message if you try to show the viewer for an array that starts with a null element. A minimal example causing the behavior is a file that looks like this:

[null,1]

File contents are deleted if there is an error in JASON

If there is an error in JASON file, then formatting JASON deletes the remaining part of the file.

Steps to reproduce

User below JASON and perform jason formatting (Ctrl+Alt+Shift+M)

{
	"name": "npp-pluginList",
	"version": "1.0",
	"id": "b7fce57c3485abbb3a3e6a1f5f9e4f1f3d712a84271e6e6552002be9d6b3bbae",
	"npp-plugins": [
		{
			"folder-name": "switcher",
			"display-name": "switcher",
			"repository": "https://github/npp_plugins/",
			"description": "Switcher: a plugin to switch between 'associated' files. Currently it handles switching between asm, inc, cpp, h, cch and ch. Useful when assigned to a hotkey.",
			"author": "f0dder",
			"homepage": "http://f0dder.dcmembers.com/npp_plugins/"
		}
		{
			"name": "foo",
			"isFoo": true,
			"isBar": false,
			"isTrueString": "true",
			"isFalseString": "false"
		}
	]
}

notice , is missing after first list.

Expected Output:

Either report an error or at least don't delete the file.

Actual Output:

File contents have been removed from the point till end where error was there.

Version 1.22 "Show JSON Viewer" is no longer working properly.

I have some validated JSON (verified by jsonlint.com) and the viewer is only showing the first level object.

Other times, I get an 'Unknown exception': PluginsManager::runPluginCommand Exception.

It was working perfectly before I upgraded to v1.22
I removed, reinstalled, but no luck.

Sample JSON:
{
"LocationCode": "2b895573-5327-4a8e-9cd0-24dcc54a956e",
"Info": {
"DateOfService": "12/02/2015",
"InsuranceInfo": {
"IsInsured": false,
"SessionID": "2b895573-5327-4a8e-9cd0-24dcc54a956e"
}
},
"List": [{
"Type": "P",
"Price": 393.0,
"Description": "2b895573-5327-4a8e-9cd0-24dcc54a956e",
"Code": "2b895573-5327-4a8e-9cd0-24dcc54a956e"
}],
"Registration": {
"Info": {
"DateOfService": "12/02/2015",
"Insurance": {
"IsInsured": false,
"SessionID": "2b895573-5327-4a8e-9cd0-24dcc54a956e"
}
},
"SessionID": "2b895573-5327-4a8e-9cd0-24dcc54a956e"
},
"SessionID": "2b895573-5327-4a8e-9cd0-24dcc54a956e"
}

Keep up with text changes

It would be really useful if the tree view could automatically stay synchronized with changes to the json text. I don't know if the Notepad++ plugin framework facilitates this but please consider. Thanks.

Values containing \" can break formatting

I sometimes find the "Format JSON" tool fails part-way through my file. I did some testing using this string:

{"abc":{"1":"One","2":"Two","3":"Three"}}

I found that depending on where I added them, the sequence \" breaks the formatting.

Here are the scenarios I've found thus far that break formatting:

  1. Including \" immediately before the closing ".
  2. Including \"\" anywhere in a string.

Note that "Show JSON Viewer" correctly parses the text in each of these cases. It's just the formatter that's failing.

One workaround I've found for point 1 is that if I manually add a space immediately before the closing ", the formatting works.

Crash parsing 'complicated' json

I get this error when trying to treeview the json below. JSOn View 1.22 in N++ 6.9


PluginsManager::runPluginCommand Exception

Unknown exception

OK

{
"Users": [{
"Name": "SOME GUY",
"Status": "",
"LicenseType": "SOMETHING",
"UserId": "7x7x7x7x-1111-11f1-bb98-0b66faaa167c",
"SignInAddress": "[email protected]",
"isBlah": false,
"LastAccessed": "3/25/2016"
}],
"ExtensionAvailabilityFooFee": {
"ExtensionViewModel": {
"ExtensionId": "xx.yyyy-zz",
"DisplayName": "EXTEN NAME",
"ExtensionState": null,
"AllOrNothing": false,
"IsFooFee": false,
"BlahStartDate": null,
"GraceFerb": 0,
"FoobPeriod": 0
},
"InUse": 1,
"Total": 1
},
"ExtensionErrors": null
}

Formatting JSON

Formatting a JSON file with line comments does not work 100%. For example, formatting the following:

   {"file_IN_FileFilter_StartsWith": {    "value": "Pattern_InSample"   }, // first part of file name
        "file_IN_FileFilter_EndsWith": {     "value": ""         }
        }

will result in the following:

   "file_IN_FileFilter_StartsWith": {
   	"value": "Pattern_InSample"
   },
   //firstpartoffilename"file_IN_FileFilter_EndsWith": {
   	"value": ""
   }
} 

The comment concatenates with a key.

I also noticed that when formatting the json file that has space for identation and CRLF as EOL, will be converted to tab and LF. Is it possible to have a setting that states what should be used when formatting the json file?

Formatter sometimes hangs up because of escaped double quotes in string literals

The following json string cannot be formatted. If one selects it and uses "Format JSON", Notepad++ will hang.

{"k0":[{"k1":"a\"b\"","k2":{"k3":"a\"b\"c"}}]}

There are probably shorter examples. But this basic example works properly :

{"k": "\"v\""}

The same string without the escaped double quotes will format properly to

{
    "k0": [{
        "k1": "ab",
        "k2": {
            "k3": "abc"
        }
    }]
}

Incorrect spelling in viewer

I noticed that the value of false (unquoted) displays incorrectly in the tree viewer.

{
  "name": "foo",
  "isFoo": true,
  "isBar": false,
  "isTrueString": "true",
  "isFalseString": "false"
}

See the value for isBar displays as: fals

Error Highlighting needs line an character or better explanation

You just get some generic warning and a highlighted gray (which doesn't give you any clue as to why its failing). a line number and character position would be nice, but a lot of times I have valid json which gets rejected. I'm guessing that must be because its expecting some expression to be in quotes and its not, but for formatting and/or tree view that seems too stringent. Its still easy to know where the field is and the value ends without it being perfect JSON.

Copy value from JSON Viewer

It'd be awesome if you could copy the value directly from the JSON viewer object.

Flow would be something like

  1. Right click object in JSON Viewer
  2. Click Copy
  3. Viola

Cannot install - Bad hash

I had this plugin but it no longer works even though I have the DLL in y plugins folder. When I attempt to install it with the manager I get:
The hash of plugin package "MPPJSPNViewerX64.zip" is not correct. Exprected:
8aa2b15de7992f7699c92ac89212dc966a146bec9651ba4c2220e40bc5544e36
<> Found:
df0ba2f0aebc2f20845e5728269d8d1ea962924983ffc79fbd56383ef293a3
This plugin won't be installed.

Can this be fixed? Where can a get the correct .dll?

As a side note, I have never understood why developers do not make the text in the error popups selectable. It was a pain typing all that by hand and it probably has typos in it. It would have been so much easier to cut and paste

64-bit version

Hi, Are you planning to create a 64-bit version? I have installed the x64 ver of Notepad++, but I can't install the plugin.

Thanks

Error in selection based json formatting

When I selected a json response from a web service as text and try to format that using the plugin, error is displayed.

After the error dialog box, the selection changes. Attached the gif for the same
HTbU5oLJf4

Can't download release

When trying to download a release I get an error response that basically indicates an invalid signature

<Error><Code>SignatureDoesNotMatch</Code><Message>The request signature we calculated does not match the signature you provided. Check your key and signing method.</Message><AWSAccessKeyId>AKIAIWNJYAX4CSVEH53A</AWSAccessKeyId><StringToSign>AWS4-HMAC-SHA256
20170807T113434Z
20170807/us-east-1/s3/aws4_request
ed40876d97de775f816caa79f7361f24740ada3cd02e8968e3f4f7acc8fbe587</StringToSign><SignatureProvided>58a9bf145d387206ff7c80fa9140624e8606560a18eb35049773d54d6a0d6e0a</SignatureProvided><StringToSignBytes>41 57 53 34 2d 48 4d 41 43 2d 53 48 41 32 35 36 0a 32 30 31 37 30 38 30 37 54 31 31 33 34 33 34 5a 0a 32 30 31 37 30 38 30 37 2f 75 73 2d 65 61 73 74 2d 31 2f 73 33 2f 61 77 73 34 5f 72 65 71 75 65 73 74 0a 65 64 34 30 38 37 36 64 39 37 64 65 37 37 35 66 38 31 36 63 61 61 37 39 66 37 33 36 31 66 32 34 37 34 30 61 64 61 33 63 64 30 32 65 38 39 36 38 65 33 66 34 66 37 61 63 63 38 66 62 65 35 38 37</StringToSignBytes><CanonicalRequest>GET
/2963072/1169390
X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20170807%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20170807T113434Z&X-Amz-Expires=300&X-Amz-SignedHeaders=host&actor_id=0&response-content-disposition=attachment%3Bfilename%20NPPJSONViewer-x64.dll.zip&response-content-type=application%2Fzip
host:github-production-repository-file-5c1aeb.s3.amazonaws.com

host
UNSIGNED-PAYLOAD</CanonicalRequest><CanonicalRequestBytes>47 45 54 0a 2f 32 39 36 33 30 37 32 2f 31 31 36 39 33 39 30 0a 58 2d 41 6d 7a 2d 41 6c 67 6f 72 69 74 68 6d 3d 41 57 53 34 2d 48 4d 41 43 2d 53 48 41 32 35 36 26 58 2d 41 6d 7a 2d 43 72 65 64 65 6e 74 69 61 6c 3d 41 4b 49 41 49 57 4e 4a 59 41 58 34 43 53 56 45 48 35 33 41 25 32 46 32 30 31 37 30 38 30 37 25 32 46 75 73 2d 65 61 73 74 2d 31 25 32 46 73 33 25 32 46 61 77 73 34 5f 72 65 71 75 65 73 74 26 58 2d 41 6d 7a 2d 44 61 74 65 3d 32 30 31 37 30 38 30 37 54 31 31 33 34 33 34 5a 26 58 2d 41 6d 7a 2d 45 78 70 69 72 65 73 3d 33 30 30 26 58 2d 41 6d 7a 2d 53 69 67 6e 65 64 48 65 61 64 65 72 73 3d 68 6f 73 74 26 61 63 74 6f 72 5f 69 64 3d 30 26 72 65 73 70 6f 6e 73 65 2d 63 6f 6e 74 65 6e 74 2d 64 69 73 70 6f 73 69 74 69 6f 6e 3d 61 74 74 61 63 68 6d 65 6e 74 25 33 42 66 69 6c 65 6e 61 6d 65 25 32 30 4e 50 50 4a 53 4f 4e 56 69 65 77 65 72 2d 78 36 34 2e 64 6c 6c 2e 7a 69 70 26 72 65 73 70 6f 6e 73 65 2d 63 6f 6e 74 65 6e 74 2d 74 79 70 65 3d 61 70 70 6c 69 63 61 74 69 6f 6e 25 32 46 7a 69 70 0a 68 6f 73 74 3a 67 69 74 68 75 62 2d 70 72 6f 64 75 63 74 69 6f 6e 2d 72 65 70 6f 73 69 74 6f 72 79 2d 66 69 6c 65 2d 35 63 31 61 65 62 2e 73 33 2e 61 6d 61 7a 6f 6e 61 77 73 2e 63 6f 6d 0a 0a 68 6f 73 74 0a 55 4e 53 49 47 4e 45 44 2d 50 41 59 4c 4f 41 44</CanonicalRequestBytes><RequestId>44E41150FC779A41</RequestId><HostId>X5kp70HyCWtQxNqdbumQ59FlgYa5PJSoKBl3ExGwdND/fCfsa98jMmZ5XGCNNrRZvJKF2FQ9FW8=</HostId></Error>

notepad ++ crash

Hallo,

following string, causes the plugin to crash notepad ++

[
"BeginOfEnumerable",
[
{
"profileid": 10820
}
],
"EndOfEnumerable"
]

JsonViewer 1.32
Notepad++ v7.6.3 (64-bit)
Build time : Jan 27 2019 - 17:16:47
Path : C:\Program Files\Notepad++\notepad++.exe
Admin mode : OFF
Local Conf mode : OFF
OS : Windows 10 (64-bit)
Plugins : ComparePlugin.dll DSpellCheck.dll mimeTools.dll NppConverter.dll NPPJSONViewer.dll NppXmlTreeviewPlugin.dll PluginManager.dll SqlInFormNpp64.dll XMLTools.dll

new Date(1362523281808)

When parsing the JSON with new Date(1362523281808), the result eliminates the space between new and Date

{"timestamp":new Date(1362523281808)}

parses to

{
    "timestamp": newDate(1362523281808)
}

n++ 6.2 unicode and plugin version 1.21

64 bit binary on Sourceforge

Could you please put a 64 bit build of this plugin on sourceforge.net? The file currently there only works with the 32 bit build of Notepad++. Thanks.

Strange transformations happen when formatting a JSON string - number rounding occurs

If you have the following text in a file and try to use format JSON functionality it is transformed to something that is not exactly the same representation. Some rounding occurs.

Orignal text:
{"theNumber":4475.3299999999999}

Formatted JSON text:
{
"theNumber": 4475.33
}

Expected formatted JSON text (what should be the correct):
{
"theNumber":4475.3299999999999
}

Format JSON changes numeric values

I noticed that some numeric values are changed after formatting the JSON.

To reproduce:
1.Input the following text and select it
{"number":-1722.1864265316147}
2.Format text using "Plugins-JSON Viewer-Format JSON"
3.The result is
{
"number": -1722.1864265316149
}

Tab setting not respected by JSON formatter

I've set global NPP option:
Preferences>Language>Tab Settings>JSON>Tab size=4, Replace by space

I believe that this setting should be respected by JSON Formatter tool. Currently, formatter always uses TABs.

v.1.3.1 - 32bit NPP - Access Violation

I have a valid JSON (1st trying with this plugin go figure) and activate and get a msgbox from the plugin stating "Access Violation" as shown here:

snag_10-10-2018_22-00-48

Ideas? I have many NPP plugins (I'm still running 32bit NPP on 64bit WIN7 for plugin compatibility) and this is the only one currently generating an error.

Can't Install: JSON Viewer not listed in Plugin Manager

Thanks for providing a great plugin - it's proved helpful at times.

However, after re-imaging a windows 10 box, I'm unable to re-install JSON-Viewer.

It's not available via the plugin manager for Notepad++ 6.9.2 or 7,,
and I can't seem to get the manual copy NPPJSONViewer.dll trick to work...

any suggestions?

Incorrect indentation for nested array

Given this minified JSON:

{"tokens":{"access":["access1","access2","access3","access4","access5"],"completion":"completion1","signature":"tokenSig"}}

The formatted JSON is:

{
    "tokens": {
        "access": ["access1",
        "access2",
        "access3",
        "access4",
        "access5"],
        "completion": "completion1",
        "signature": "tokenSig"
    }
}

I think this obscures the level of hierarchy introduced by the nested array. It should probably be more like this:

{
    "tokens": {
        "access": [
            "access1",
            "access2",
            "access3",
            "access4",
            "access5"
        ],
        "completion": "completion1",
        "signature": "tokenSig"
    }
}

Super useful plugin, thanks!

Crashing Notepad++

Trying to display "{"AssetIds":[2,3],"AssetUids":null,"AttributeIds":[1,6,9,11,2,3,48],"AttributeNames":null,"StartTimeUtc":"2019-11-11T12:00:00Z","EndTimeUtc":"2019-11-12T12:00:00Z","QueryPageProterty":{"IsEndOfQuery":false,"CurrentMaxPage":500,"CorrelationId":"2019-11-28,04:56:39.018-QueryPage-aa751e69-bee5-40c5-a37f-a86068c05ef4","CurrentPage":0,"ContinuationToken":null}}"

not listed under Plugins menu

I've installed this plugin by :

  • open NPP
  • select Plugins / Open Plugins Folder
  • copying latest DLL there
  • restart NPP
    Open a json file, and navigate to Plugins / ... but no "JSON Viewer" option :(

Also tried with plugin Admin... select from "Available" json viewer 1.32, Install, but nothing again... not even the DLL on the folder...

So, what's wrong? Thanks for any hint

"Format JSON" leaving too many spaces

Hello,

When i choose the 'Format JSON' option from the menubar then it leaves too many spaces in the front of each item, have a look at the photo.

Photo: http://goo.gl/Lkv4YP

Notepad++ Debug Info:
Notepad++ v6.8.8
Build time : Dec 10 2015 - 01:11:37
Path : C:\Program Files (x86)\Notepad++\notepad++.exe
Admin mode : OFF
Local Conf mode : OFF
OS : Windows 10
Plugins : mimeTools.dll NppConverter.dll NppExport.dll NPPJSONViewer.dll PluginManager.dll

  • Thanks!

Format Should Follow Line Break Settings

When formatting, \n (LF) will always be used as the new line character. Formatting should respect the option set in Preferences -> New Document -> Format (Line ending).

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.