How to open local JSON file? Topic is solved
Moderator: trava90
Forum rules
This board is for technical/general usage questions and troubleshooting for the Pale Moon browser only.
Technical issues and questions not related to the Pale Moon browser should be posted in other boards!
Please keep off-topic and general discussion out of this board, thank you!
This board is for technical/general usage questions and troubleshooting for the Pale Moon browser only.
Technical issues and questions not related to the Pale Moon browser should be posted in other boards!
Please keep off-topic and general discussion out of this board, thank you!
- szczelnybez
- Apollo supporter
- Posts: 34
- Joined: 2021-01-20, 00:11
How to open local JSON file?
It appears that PM opens JSON files correctly from remote servers and not from local drive, i.e. "file:///..."
From local drive files are being opened in a text format instead of tree-view structure. I have devtools.jsonview.enabled set to true. I also tried adding prefix "view-source:" to no avail. FF seems to open local files correctly. Any hints please?
Regards
From local drive files are being opened in a text format instead of tree-view structure. I have devtools.jsonview.enabled set to true. I also tried adding prefix "view-source:" to no avail. FF seems to open local files correctly. Any hints please?
Regards
Re: How to open local JSON file?
WORKSFORME
(by the way, json viewer is enabled by default, no need to set any preferences manually for it)
How exactly are you opening the json file?
(by the way, json viewer is enabled by default, no need to set any preferences manually for it)
How exactly are you opening the json file?
"Sometimes, the best way to get what you want is to be a good person." -- Louis Rossmann
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite
- szczelnybez
- Apollo supporter
- Posts: 34
- Joined: 2021-01-20, 00:11
Re: How to open local JSON file?
Hi Moonchild,
What is WORKSFORME?
I open them using File-> Open File... and expect to see the result as per your attached image. However, for some reason, they present themselves as text files.
It happens either:
- if download a remote file directly to my drive and then open it manually in PM,
- or I first connect to a remote file in the browser (which shows correctly as per you attachment), then File --> save page as a file locally and reopen it in browser.
There must be some setting that causes it or AddOn maybe...
My version is 29.4.3 and Win10 64bit.
Regards
What is WORKSFORME?
I open them using File-> Open File... and expect to see the result as per your attached image. However, for some reason, they present themselves as text files.
It happens either:
- if download a remote file directly to my drive and then open it manually in PM,
- or I first connect to a remote file in the browser (which shows correctly as per you attachment), then File --> save page as a file locally and reopen it in browser.
There must be some setting that causes it or AddOn maybe...
My version is 29.4.3 and Win10 64bit.
Regards
Re: How to open local JSON file?
A jab at bug labels. It's "Works for me".
I tried the exact same method using File->Open and the result is the same (it works). Initially I dragged and dropped the file.
Please reply with the output of Help -> Troubleshooting information pasted in your post (please use the forum's hide or code tags)
"Sometimes, the best way to get what you want is to be a good person." -- Louis Rossmann
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite
Re: How to open local JSON file?
Me too.
Pale Moon opens JSON files from my local drive in text format.
Tested with a fresh profile (hence no Troubleshooting information) -> Pale Moon 29.4.3/Win7.
Pale Moon opens JSON files from my local drive in text format.
Tested with a fresh profile (hence no Troubleshooting information) -> Pale Moon 29.4.3/Win7.
- szczelnybez
- Apollo supporter
- Posts: 34
- Joined: 2021-01-20, 00:11
Re: How to open local JSON file?
MoonChild,
Here's the troubleshooting log:
You can see I've also disabled all the AddOns which had no effect on the issue...
Just FYI a screenshot how it looks like:
Edit:
Just realized the above file wouldn't open in FF either due to missing quotes. I've added them and now FF opens it properly, sadly not PM... Screenshot below:
Regards
Here's the troubleshooting log:
Just FYI a screenshot how it looks like:
Just realized the above file wouldn't open in FF either due to missing quotes. I've added them and now FF opens it properly, sadly not PM... Screenshot below:
Re: How to open local JSON file?
Not sure if I see this correctly with your jacked up fonts in your screenshots, but are the outer-most brackets square? If so, that's not valid JSON. Invalid JSON won't be pretty-printed.
"Sometimes, the best way to get what you want is to be a good person." -- Louis Rossmann
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite
- szczelnybez
- Apollo supporter
- Posts: 34
- Joined: 2021-01-20, 00:11
Re: How to open local JSON file?
Not sure why this happened but when you right click and select "view image" you can see the original resolution.with your jacked up fonts in your screenshots
Yes.are the outer-most brackets square?
I've reedited the file again (even though previous version was recognized by FF) and unfortunately it didn't help, see below.
Re: How to open local JSON file?
Looking into this a bit more seems the json spec has changed to now be a pretty much "anything goes" kind of deal, which I find odd, but eh.
Anyway, it seems our version of the developer tools content sniffer isn't detecting it as json notation and as such displays the raw text instead of launching the "pretty" json viewer. Since there are no other indications about the file's type when opening from a local file (a web server would explicitly indicate content-type making this work) there isn't really a way to work around this at the moment. The browser isn't primarily designed to be a local file viewer so you can consider that a limitation of using a web browser as such.
It's on my radar now but I have no idea when we'll get to it.
Anyway, it seems our version of the developer tools content sniffer isn't detecting it as json notation and as such displays the raw text instead of launching the "pretty" json viewer. Since there are no other indications about the file's type when opening from a local file (a web server would explicitly indicate content-type making this work) there isn't really a way to work around this at the moment. The browser isn't primarily designed to be a local file viewer so you can consider that a limitation of using a web browser as such.
It's on my radar now but I have no idea when we'll get to it.
"Sometimes, the best way to get what you want is to be a good person." -- Louis Rossmann
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite
- szczelnybez
- Apollo supporter
- Posts: 34
- Joined: 2021-01-20, 00:11
Re: How to open local JSON file?
My advise would be first to check the extension (i.e. *.json) and then try to parse it through the json viewer in the background, if possible. The viewer must/should have a way of telling if the code is fine or throw an error. Only if latter, json should be opened as a text file.
Re: How to open local JSON file?
It's not that simple when you are dealing with potentially hostile content. You can't just throw random parsers at it and "hope for the best, try something else if it fails".
"Sometimes, the best way to get what you want is to be a good person." -- Louis Rossmann
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite
- szczelnybez
- Apollo supporter
- Posts: 34
- Joined: 2021-01-20, 00:11
Re: How to open local JSON file?
You can, providing the viewer isn't security critical, privileged piece of code. If it is then I agree."hope for the best, try something else if it fails"
Re: How to open local JSON file?
Anything not explicitly running as a content viewer with all the safeguards that come with it is security-critical, privileged code. I simply disagree with your suggestion because it's not only wasteful trial-and-error, it's also something that would make many more parts of the code in need of sec audit with that approach as the attack surface will grow exponentially.szczelnybez wrote: ↑2022-01-16, 19:17You can, providing the viewer isn't security critical, privileged piece of code. If it is then I agree."hope for the best, try something else if it fails"
However, I've also, verified that we at least support your json structure, and we do (including top-level array structures, not strictly object structures as I suspected with my slightly outdated knowledge of the json specification).
So, something else seems to be going on here. Does your json have a BOM marker, by any chance?
Can you please attach the file you're having trouble with?
"Sometimes, the best way to get what you want is to be a good person." -- Louis Rossmann
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite
Re: How to open local JSON file?
Weird.
All JSON-files (files within Pale Moon's profile folder) opened with Pale Moon show only the raw data.
There is no option to toggle between raw data and JSON.
No problem with my secondary browser.
All JSON-files (files within Pale Moon's profile folder) opened with Pale Moon show only the raw data.
There is no option to toggle between raw data and JSON.
No problem with my secondary browser.
Re: How to open local JSON file?
No problem here. I even tried putting xulstore.json from my profile in the exact same path shown in your address bar and it's all good.
"Sometimes, the best way to get what you want is to be a good person." -- Louis Rossmann
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite
Re: How to open local JSON file?
Thanks for testing.
In fact it is not an issue for me.
Only irritation on my part was: why does it work for others and doesn't for me.
In fact it is not an issue for me.
Only irritation on my part was: why does it work for others and doesn't for me.
Re: How to open local JSON file?
Doesn't work for me either, gepus. Just raw text. Honestly I don't know if it ever did. Several years ago, I installed a JSON Viewer program and a plugin for another editor for that purpose. (Just reporting, did not troubleshoot.)
Win10home(1709), PM33.1.0-portable as of Apr 23, '24
- szczelnybez
- Apollo supporter
- Posts: 34
- Joined: 2021-01-20, 00:11
Re: How to open local JSON file?
Fair enough, security first!Moonchild wrote: ↑2022-01-16, 19:34Anything not explicitly running as a content viewer with all the safeguards that come with it is security-critical, privileged code.szczelnybez wrote: ↑2022-01-16, 19:17You can, providing the viewer isn't security critical, privileged piece of code. If it is then I agree."hope for the best, try something else if it fails"
Looking at other's comments it appears it's not only me who has troubles opening various json files. I'm not sure about BOM marker, but the file's content is as displayed in the previous screenshot.
Not sure how to attach a file in this forum but here is a copy & paste of the "pmoon2.json":Can you please attach the file you're having trouble with?
Re: How to open local JSON file?
no, you really have to attach it. copy/pasting won't help if there's a byte-level issue that won't show up in processed plaintext post bodies.
At the bottom of the post writing area when you reply are 2 tabs, "options" and "attachments". Click "attachments" and follow the obvious steps from there to add the file (you probably need to zip it up).
At the bottom of the post writing area when you reply are 2 tabs, "options" and "attachments". Click "attachments" and follow the obvious steps from there to add the file (you probably need to zip it up).
"Sometimes, the best way to get what you want is to be a good person." -- Louis Rossmann
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite