Work with a JSON map in tiled? - json

I have a problem with Tiled...
When I create a map it's all correct, I SAVE IT IN TO A JSON FILE, I try the map in my game.. all correct.. The problem is that when I try to open the map again with Tiled, It says that He can't open the map.
Is it because I saved it in to a JSON File?
I don't know how to use XML, so I can only work with JSON, but I want to do some changes to the map sometimes!!
What can I do?

That may be a bug in Tiled. Please open an issue about it at https://github.com/bjorn/tiled/issues, mentioning the exact error message and preferably providing the JSON file so that I can try to reproduce it.

Related

Unexpected end of JSON input with MongoDB Compass

I exported my local MongoDB Collections using the JSON file type on my pc. Then I wanted to import these Collections on my root server using MongoDB Compass.
Everytime when I try to export the Collection, it throws the following error:
That's how my JSON file looks like:
{..."settings":{"inventory":{"crate":{"$numberInt":"0"},"cratekey":{"$numberInt":"0"},"pickaxe":{"$numberInt":"0"},...}
(I don't know if it's relevant to answer this question but this JSON line is just 1/142000)
How can I fix this error?
TL;DR
You need to have 1 empty line at the very bottom of the json file.
Long version
I don't know if this will help your case, but I ran into a similar issue when trying to import json data. I had 1 document per line, but something was still wrong. I then exported a similar piece of data as json, and tried playing around with it to see what was causing the issue. It turns out that the json must have an empty line at the bottom. So let's say you have 1 document to import. You place the entire document onto the first line. Then you just hit enter and create the second line at the bottom. After this, my data was imported without a problem.
So the problem is you need to minify your json document. That is it should be in one line. So here's link to website where you will paste your json document on the left and get the minified document on the right. It worked for me. I hope this also helps you.
https://codebeautify.org/jsonminifier
I had exact same problem, apparently their should be one document per line.
However use https://studio3t.com/ it'll work fine.

How to view contents of JSON file? Data type error

I am trying to view the contents of a json file but everything I use it doesn't load.
I tried many sites that claimed to be json viewers, extensions for browser, application and even when trying to edit in notepad++ it seems to be completely unreadble I am not sure if it's obfuscated/encrypted or if I am just doing the wrong thing.
I have tried googling many sources about this and have came to the conclusion that I am not aware of what "type" of json file this is and how to read it. Every application I have used gives data type error, which suggests it is only able to be viewed/compiled in a specific program / method.
I am wondering if anybody can help point me in the right direction! Below I will attach the json file contents
Warning: Large file may take a while to load in browser window
Example of code:
¦¦p­ÛâTÅbØ*«‹c—¤Î`¯²ÆSú0ÒEX…ÕÊh QDN ‘ùîó/8dzҩݾ 4Ý(úk48–v¹Ôì¯úÓ„é…ƒº¯ÈŸ k"l¾NüžÏ¹úá¾Oð¹ )yà]ŒZš[>øÜáRÜ>¼ksÎÞT,èJ×Àåÿ;+\ LÙ ¯Ki5Uù×]åÁgp
I am sorry if this is not enough information, I am not sure what information is needed from me, I hope I provided enough, if anybody requires viewing the full contents of the json file to help further inspect this I would be happy to :) It is too large to upload to a site like pastebin or others

Correct way of importing data from json in Ionic 2 using an interface

I'm really wondering what's the correct and best-practice way for importing data from a json file in an ionic 2 project so I can show it in a template, for example.
Some solutions I can find use interfaces, some don't. Some implement own small services, some don't. Some use http.get().map().subscribe(), some just use subscribe(). I would really like to know how to do this properly and would be glad if somebody could enlighten me.
From my view the best practice is to use a service and use http get request to get json file from your server. We did the same for getting language json file.
If you want securely get json file then you should put your json file at secure folder rather than public folder and create an api to get json file or json object from server.
Hope it will help

Get a .tmx file from its .json

I've been using Tiled to create .tmx maps for one of my projects, maps that I export to JSON before using with Phaser.js.
Problem is, a few months ago I mistakenly deleted the .tmx file for the game first map. It's still working fine but now I can't change anything on the first map layout with Tiled because I only have the JSON for it.
I've been looking for an answer with no success so far, but is there a way to convert a .json Tiled map exported from a .tmx file, back to its original format ?
You should be able to simply open the JSON exported map in Tiled, and save it again as a TMX file. To be able to select the file, you may need to change the file type in the Open File dialog.
Btw, you should consider committing your project to a version control system (Git is a popular one), so that such mistakes will not generally lead to loss of data. You don't always get lucky.

Custom JSON file doesn't work with Highcharts

I'm very new to HighCharts and have a question about integrating JSON files.
I'm attempting to call a JSON file for my HighCharts file, however when I attempt to call it, the chart breaks and nothing is displayed. I am using the base Highcharts code in order to do this.
Here is my JSON input file that I am trying to use:
[
[Date.UTC(2012,00,01),2],
[Date.UTC(2012,00,02),6],
[Date.UTC(2012,00,03),4],
[Date.UTC(2012,00,04),0],
[Date.UTC(2012,00,05),2],
[Date.UTC(2012,00,06),3],
[Date.UTC(2012,00,07),1],
[Date.UTC(2012,00,08),3],
[Date.UTC(2012,00,09),7],
[Date.UTC(2012,00,10),8]
]
I have found other examples which say that it would be better to create an array with the data in it and put it into the JS file, and while that may work now it won't be feasible in the future as the chart will eventually have to reference large JSON files that will be stored in another directory.
Here's a link to the JSFiddle that references the outside JSON file. Any help would be appreciated.