NPP-JSONViewer / JSON-Viewer

A JSON viewer plugin for Notepad++. Displays the selected JSON string in a tree view.
MIT License
743 stars 151 forks source link

Click Format JSON and the text disappears #49

Closed doraemonlei closed 5 years ago

kapilratnani commented 5 years ago

Already reported. Will release the fix soon.

sharon-pl commented 5 years ago

same issue here!! thank you for taking care of this!

JanDoggen commented 5 years ago

I just experienced the same issue. Reason: I accidentally had text in front of my block of JSON data. The plugin seems to choke on that.

kapilratnani commented 5 years ago

@JanDoggen Please share the sample text, if possible.

JanDoggen commented 5 years ago

I'm sorry, I no longer have that specific text at hand, and I cannot reproduce it now

doraemonlei commented 5 years ago

@kapilratnani {image_id': '2p1XwgpAUUKkPus0JXSC0A==', 'request_id': '1548144873,9e7f7a17-6f10-421f-8fa5-331a58fd55b9', 'time_used': 452, 'faces': [{'landmark': {'contour_chin': {'y': 977, 'x': 521}, 'left_eye_upper_left_quarter': {'y': 397, 'x': 300}, 'mouth_lower_lip_right_contour1': {'y': 767, 'x': 571}, 'left_eye_bottom': {'y': 451, 'x': 333}, 'mouth_lower_lip_right_contour2': {'y': 790, 'x': 595}, 'contour_left7': {'y': 661, 'x': 177}, 'contour_left6': {'y': 615, 'x': 166}, 'contour_left5': {'y': 569, 'x': 158}, 'contour_left4': {'y': 523, 'x': 152}, 'contour_left3': {'y': 476, 'x': 150}, 'contour_left2': {'y': 429, 'x': 150}, 'contour_left1': {'y': 381, 'x': 155}, 'left_eye_lower_left_quarter': {'y': 439, 'x': 299}, 'contour_right1': {'y': 404, 'x': 858}, 'contour_right3': {'y': 494, 'x': 861}, 'contour_right2': {'y': 449, 'x': 861}, 'contour_right5': {'y': 583, 'x': 851}, 'contour_right4': {'y': 539, 'x': 857}, 'contour_right7': {'y': 670, 'x': 831}, 'left_eyebrow_left_corner': {'y': 325, 'x': 213}, 'right_eye_right_corner': {'y': 429, 'x': 748}, 'nose_bridge1': {'y': 412, 'x': 517}, 'nose_bridge3': {'y': 526, 'x': 515}, 'nose_bridge2': {'y': 469, 'x': 516}, 'right_eyebrow_upper_left_corner': {'y': 305, 'x': 593}, 'mouth_upper_lip_right_contour4': {'y': 761, 'x': 571}, 'mouth_upper_lip_right_contour1': {'y': 717, 'x': 550}, 'right_eye_left_corner': {'y': 444, 'x': 617}, 'left_eyebrow_upper_right_corner': {'y': 304, 'x': 434}, 'left_eyebrow_upper_middle': {'y': 266, 'x': 318}, 'mouth_lower_lip_right_contour3': {'y': 805, 'x': 561}, 'nose_left_contour3': {'y': 624, 'x': 412}, 'mouth_lower_lip_bottom': {'y': 813, 'x': 520}, 'mouth_upper_lip_right_contour2': {'y': 739, 'x': 590}, 'left_eye_top': {'y': 390, 'x': 337}, 'nose_left_contour1': {'y': 443, 'x': 458}, 'mouth_upper_lip_bottom': {'y': 760, 'x': 520}, 'mouth_upper_lip_left_contour2': {'y': 744, 'x': 443}, 'mouth_upper_lip_top': {'y': 725, 'x': 520}, 'mouth_upper_lip_left_contour1': {'y': 719, 'x': 488}, 'mouth_upper_lip_left_contour4': {'y': 764, 'x': 463}, 'right_eye_top': {'y': 400, 'x': 688}, 'mouth_upper_lip_right_contour3': {'y': 769, 'x': 608}, 'right_eye_bottom': {'y': 460, 'x': 690}, 'right_eyebrow_lower_left_corner': {'y': 341, 'x': 598}, 'mouth_left_corner': {'y': 779, 'x': 404}, 'nose_middle_contour': {'y': 662, 'x': 516}, 'right_eye_lower_right_quarter': {'y': 450, 'x': 725}, 'right_eyebrow_lower_right_quarter': {'y': 337, 'x': 768}, 'contour_right9': {'y': 756, 'x': 805}, 'mouth_right_corner': {'y': 770, 'x': 623}, 'right_eye_lower_left_quarter': {'y': 455, 'x': 651}, 'right_eye_center': {'y': 427, 'x': 669}, 'left_eye_upper_right_quarter': {'y': 404, 'x': 381}, 'right_eyebrow_lower_left_quarter': {'y': 329, 'x': 654}, 'left_eye_pupil': {'y': 417, 'x': 358}, 'contour_right8': {'y': 714, 'x': 819}, 'contour_left13': {'y': 901, 'x': 323}, 'left_eyebrow_lower_right_quarter': {'y': 320, 'x': 374}, 'left_eye_right_corner': {'y': 442, 'x': 409}, 'left_eyebrow_lower_right_corner': {'y': 337, 'x': 427}, 'mouth_upper_lip_left_contour3': {'y': 777, 'x': 421}, 'left_eyebrow_lower_left_quarter': {'y': 318, 'x': 264}, 'mouth_lower_lip_left_contour1': {'y': 772, 'x': 463}, 'mouth_lower_lip_left_contour3': {'y': 810, 'x': 475}, 'mouth_lower_lip_left_contour2': {'y': 798, 'x': 436}, 'contour_left9': {'y': 752, 'x': 204}, 'left_eye_lower_right_quarter': {'y': 449, 'x': 374}, 'contour_right6': {'y': 627, 'x': 842}, 'nose_tip': {'y': 582, 'x': 514}, 'right_eyebrow_upper_middle': {'y': 275, 'x': 716}, 'right_eyebrow_lower_middle': {'y': 331, 'x': 713}, 'left_eye_center': {'y': 417, 'x': 358}, 'right_eyebrow_upper_left_quarter': {'y': 283, 'x': 648}, 'right_eyebrow_right_corner': {'y': 344, 'x': 819}, 'right_eyebrow_upper_right_quarter': {'y': 293, 'x': 779}, 'contour_left16': {'y': 973, 'x': 462}, 'contour_left15': {'y': 956, 'x': 410}, 'contour_left14': {'y': 931, 'x': 364}, 'left_eyebrow_upper_right_quarter': {'y': 279, 'x': 383}, 'contour_left12': {'y': 869, 'x': 285}, 'contour_left11': {'y': 834, 'x': 252}, 'contour_left10': {'y': 794, 'x': 226}, 'left_eyebrow_lower_middle': {'y': 316, 'x': 318}, 'left_eyebrow_upper_left_quarter': {'y': 279, 'x': 256}, 'right_eye_upper_right_quarter': {'y': 408, 'x': 724}, 'nose_right_contour4': {'y': 643, 'x': 588}, 'nose_right_contour5': {'y': 650, 'x': 553}, 'nose_left_contour4': {'y': 642, 'x': 444}, 'nose_left_contour5': {'y': 649, 'x': 479}, 'nose_left_contour2': {'y': 570, 'x': 430}, 'nose_right_contour1': {'y': 445, 'x': 577}, 'nose_right_contour2': {'y': 572, 'x': 604}, 'nose_right_contour3': {'y': 627, 'x': 621}, 'left_eye_left_corner': {'y': 419, 'x': 276}, 'contour_right15': {'y': 952, 'x': 623}, 'contour_right14': {'y': 927, 'x': 664}, 'contour_right16': {'y': 969, 'x': 576}, 'contour_right11': {'y': 834, 'x': 763}, 'contour_right10': {'y': 797, 'x': 786}, 'contour_right13': {'y': 898, 'x': 700}, 'contour_right12': {'y': 869, 'x': 733}, 'contour_left8': {'y': 707, 'x': 188}, 'mouth_lower_lip_top': {'y': 768, 'x': 519}, 'right_eye_upper_left_quarter': {'y': 411, 'x': 645}, 'right_eye_pupil': {'y': 427, 'x': 669}}, 'attributes': {'emotion': {'sadness': 0.002, 'neutral': 97.224, 'disgust': 0.002, 'anger': 0.002, 'surprise': 0.838, 'fear': 0.002, 'happiness': 1.929}, 'beauty': {'female_score': 62.1, 'male_score': 60.975}, 'gender': {'value': 'Female'}, 'age': {'value': 4}, 'mouthstatus': {'close': 100.0, 'surgical_mask_or_respirator': 0.0, 'open': 0.0, 'other_occlusion': 0.0}, 'glass': {'value': 'None'}, 'skinstatus': {'dark_circle': 3.358, 'stain': 5.442, 'acne': 9.075, 'health': 8.656}, 'headpose': {'yaw_angle': 1.3155217, 'pitch_angle': 3.8052115, 'roll_angle': -0.50208443}, 'blur': {'blurness': {'threshold': 50.0, 'value': 0.358}, 'motionblur': {'threshold': 50.0, 'value': 0.358}, 'gaussianblur': {'threshold': 50.0, 'value': 0.358}}, 'smile': {'threshold': 50.0, 'value': 0.571}, 'eyestatus': {'left_eye_status': {'normal_glass_eye_open': 0.007, 'no_glass_eye_close': 0.0, 'occlusion': 0.0, 'no_glass_eye_open': 99.992, 'normal_glass_eye_close': 0.001, 'dark_glasses': 0.0}, 'right_eye_status': {'normal_glass_eye_open': 0.0, 'no_glass_eye_close': 0.0, 'occlusion': 0.0, 'no_glass_eye_open': 100.0, 'normal_glass_eye_close': 0.0, 'dark_glasses': 0.0}}, 'facequality': {'threshold': 70.1, 'value': 93.59}, 'ethnicity': {'value': 'ASIAN'}, 'eyegaze': {'right_eye_gaze': {'position_x_coordinate': 0.426, 'vector_z_component': 0.993, 'vector_x_component': -0.114, 'vector_y_component': 0.043, 'position_y_coordinate': 0.461}, 'left_eye_gaze': {'position_x_coordinate': 0.558, 'vector_z_component': 0.996, 'vector_x_component': 0.085, 'vector_y_component': -0.015, 'position_y_coordinate': 0.432}}}, 'face_rectangle': {'width': 711, 'top': 266, 'left': 144, 'height': 711}, 'face_token': '12be0a28c248ef2c690ae8ab38e38a3b'}]}

digitalsigi commented 5 years ago

Same story here: SetMessageEventArgs { Type: Error, Message: "Passwort falsch.", LogMessage: True, IsTextNotEmpty: True }

I have JSON Viewer V1.32 installed

cemontijo commented 5 years ago

I think if you have more than one independent JSON in the file (the file doesn't have an open/close brace at the very top and very bottom), then the plugin versions after 1.30a will remove any later stand-alone JSONs and only keep the top one. It'd be great if you could fix this so that it still formats all of the JSONs in the file properly like it used to, though this technically may not be considered a valid JSON if the assumption is that a file can only contain one JSON at a time.

kapilratnani commented 5 years ago

Please check the new build in the releases section

ganego commented 5 years ago

The two above still fail. I also have some json fail all the time, quite annoying. Did not check newest version yet, since I don't have any json to parse right now. But I never had this problem some years ago, it could even format non-json somewhat properly if I remember correctly.

So now It gives an error it seems instead of just doing stuff. The two above json are properly pretty-printed on this website: http://jsonparseronline.com/ - yes it throws errors, but it still pp them. Can something like this not be made possible here?

And why is 1.34 not in the npp repo (yet)? 32-bit if that matters.

kapilratnani commented 5 years ago

Above fragments are not valid JSON strings. Previous formatting code formatted the JSON like strings anyway, will see if i can achieve the same with the current code. Also, since the plugins responsibility is to handle JSON data, as the name implies, let me think if allowing the previous behavior makes sense.

kapilratnani commented 5 years ago

@ganego I just checked, 1.34 is available in npp plugin list repo.

kapilratnani commented 5 years ago

Closing as the text doesn't disappears anymore...