Questions tagged [json]
JSON (JavaScript Object Notation) is a lightweight human-readable data interchange format. It is programming language-independent and many modern programming languages include code to generate and parse JSON-format data. JSON filenames use the extension `.json`.
87 questions
0
votes
1
answer
64
views
Unity FromJson Utility Not Populating Instance of Class
I've used FromJson in Unity/C# a dozen times, and yet for some reason I cannot figure out why this one's not working.
Here's the code that does the parsing:
...
0
votes
1
answer
173
views
When saving in Json format, some places I want are not saved
I'm making a game in Unity and I'm using json format to save. I have no problem recording it on my computer, but it does not record the animals I catch on my Android phone. How can I solve this? What ...
0
votes
1
answer
180
views
Web application for efficient placement of blocks
Task: to develop a function that efficiently places rectangular blocks in
rectangular 2D container. The location of the blocks in the container should be
as dense as possible in order to rationally ...
0
votes
0
answers
155
views
Can't start Unity project, none of the scripts load and materials are pink: JSON parse error: The document is empty
I am trying to open a project from a company, the problem is, nobody has this problem except me, so one can replicate it.
When i open the project i get the following issues:
There seems to be a file ...
0
votes
1
answer
2k
views
JSON Parse Error - Invalid Value
I'm trying to create a script that parses a JSON file to get information about the levels in my project. I know this technique should work because I have the same code in two other scripts, parsing ...
2
votes
1
answer
783
views
How to store localized text data in Unity?
I need to create a lot of read-only text data. As far as I know storing a lot of data directly in the script is not good, so I need to create a separate json file with ready-made data to load in the ...
0
votes
0
answers
53
views
Entity initialization in an online game
How do online games handle creation of new entities? I currently have an EntityFactory class that requires an ID (specifying the entity type). A bunch of subroutines are executed to determine exactly ...
1
vote
0
answers
1k
views
Unity: JsonUtility.ToJson() not serializing everything
I'm trying to serialize the state of play of my Unity game (Unity 2021.3.7f1) to JSON using UnityEngine.JsonUtility.ToJson, so that I can persist this state to disk ...
0
votes
1
answer
717
views
JsonUtility deserializes list of strings, but all strings come out empty [closed]
What I have
JSON file
...
0
votes
0
answers
351
views
How to save a class full custom property types and their data to disk
Background:
My app is a sandbox with a large number of parameters that I want to be able to easily add / selectively expose to the user, edit during runtime through the game UI or from the Unity ...
0
votes
1
answer
65
views
Equipped weapon does not appear in JSON data
I'm trying to make an RPG style game with equipment using ScriptableObject, but whenever I equip the item, it does not register in my JSON data.
Here is the script ...
-1
votes
1
answer
589
views
Deserialization of JSON from Firebase to load data
i was wondering if you could help me with an issue i have with firebase and databases!
I have a class that saves variables into an array. i have managed to send that json file to firebase and i can ...
0
votes
1
answer
225
views
Parse Data on runtime into JSON
I have been trying to work out a subscription form for my game and thanks to you guys here, I came to a solution which works but still needs some changes.
The idea is to have an input field in the ...
0
votes
1
answer
2k
views
How to properly format classes for JSON deserialization with JSON.net for Unity?
**UPDATE: This answer has been solved and this post updated to **
I am creating an inventory system and decided to keep a master list of all the items. The goal is to use Newtonsoft's JSON.net to ...
0
votes
1
answer
140
views
Minecraft: `foot_size` doesn't work
I'm making an add-on that lets the player step over 1-block high blocks and the foot_size property is exactly what I'm looking for.
The documentation says the following:
"Sets the number of ...
2
votes
1
answer
2k
views
Unity3D - JsonUtility returns empty string
i have the problem that when I convert an instance of highscores through JsonUtility.ToJson the value of my value of it is always {"highscoreEntryList":[{},{},{},{},{},{},{},{},{},{},{}]}...
...
1
vote
1
answer
1k
views
JsonUtility is throwing exception when there is \" in the string
The following is my JSON file:
...
0
votes
0
answers
86
views
Questions about Jrpg NPC events (Unity C#)
So, I'm trying to wrap my head around something. I've got my basic quest system up and running for my rpg style game.
Right now I'm taking a look at NPC events and triggers that as I see it have two ...
0
votes
1
answer
2k
views
How to encode a save game / game state as a string?
I'm building an HTML game. For this game I want to implement a save-feature that should work like in some already existing games:
The user can chose export, this ...
4
votes
2
answers
2k
views
Is there a way to hardcode a JSON file into a Unity build?
I'm currently creating an external tool to generate dialogues that are exported as JSON files.
The idea is that after you create a dialogue (as a JSON), my main Unity project reads that file and ...
1
vote
1
answer
367
views
How to parse User-defined types from String?
I am trying to save data about various entities in each Level in my game in a JSON file and load it at Runtime(Like a Scene file in Unity). I can save simple stuff like floats and ints and parse them ...
0
votes
2
answers
2k
views
Why can't I read this JSON file?
I get an error every time I try to parse this .json file.
Here is the error:
...
0
votes
1
answer
4k
views
Loading a list of items from JSON, all entries are null
(I posted a very similar question here recently and the response I received was helpful. But I have been advised to start a new question, and here it is.)
I am developing a Unity game which includes ...
2
votes
1
answer
6k
views
Error: "JSON must represent an object type" when parsing array of objects
I'm trying to use Json to hold game dialog in a text asset file. I've tried to make a barebones project to test this and it is failing with the Error Message: ArgumentException: JSON must represent an ...
0
votes
1
answer
383
views
POST JSON method does not work when project has been exported to WEBGL and uploaded to firebase hosting
I have a database set up on firebase and when i run my game in the unity edtitor and as a standalone exported Windows .exe file, the call gets made correctly to the database and JSON data gets posted ...