Questions tagged [json]
The json tag has no usage guidance.
83
questions
0
votes
0
answers
28
views
Ideas for how to attach meta data to an arbitrary sprite sheet?
I am currently messing around with monogame and creating some silly sprite based games. One issue I have is when I get sprites for OpenGameArt or any equivalent they are often in spritesheets in a ...
1
vote
1
answer
215
views
Reading JSON nested objects with JsonUtility
I currently have a JSON file:
...
0
votes
1
answer
223
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 ...
0
votes
1
answer
64
views
Persistent save value, event after deleting savefile
Now, I now the title is really obscure, but I have tried to solve the following problem for so long and most of it is integrated into my game so far that I can't just copy & paste it here, so this ...
0
votes
1
answer
151
views
Problem with JSON ScriptableObject saving using NewtonSoft JSON
I am saving a list of ScriptableObjects in a JSON file using NewtonSoft JSON, the problem being that the following error message is thrown when it tries to save:
<...
0
votes
0
answers
123
views
"rigidbody property has been deprecated" when trying to save ScriptableObject to JSON with NewtonSoft
I am using NewtonSoft Json to save data in my Unity game, but when I try to save something it get this error:
...
2
votes
1
answer
245
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
2
answers
711
views
Can't serialize plain struct with Nullable fields
I try to save game data in PlayerPrefs as JSON string. I read in documentation that I can use plain struct/class with ...
0
votes
0
answers
34
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
1
answer
1k
views
Where should I put a JSON file to be readable in a Unity build?
I have a file which is created manually. In what folder should I put it so I can read it in a build?
For example Application.dataPath in editor reads the file from ...
1
vote
0
answers
842
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
2
answers
163
views
Do a quiz from web api data
i'm new to unity and i want to do a quiz using data coming from a web api
I was able to retreive data from the api but i couldn't make the game logic with them
This is where i arrived
...
0
votes
1
answer
591
views
JsonUtility deserializes list of strings, but all strings come out empty [closed]
What I have
JSON file
...
0
votes
1
answer
438
views
How to look up items by name in lists loaded from JSON data?
I'm using a JSON file for loading texts and dialogs and here's my JSON file:
...
0
votes
0
answers
127
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 ...
1
vote
1
answer
562
views
Unity - How to create a game-save with a preview image?
I want my game-save to be shown with a preview image.
This is often seen in City Builder games: The game-save usually has a name, a date and often also provides a preview of the build city (just a ...
0
votes
1
answer
38
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 ...
0
votes
2
answers
1k
views
How can I serialize lists to JSON on mobile?
I'm having difficulties serializing lists with the built in JsonUtility. I eventually figured out this just isn't possible with its limited capabilities.
As much as I'd like to use Newtonsoft, I ...
-1
votes
1
answer
418
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
0
answers
60
views
Saving JSON to firebase
I want to integrate Firebase to my android/iOS game. So far in production I used JSON to save a class into the devices PersistentDataPath and load them accordingly. I did follow the firebase ...
0
votes
1
answer
179
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
902
views
Deserialize only some fields from a JSON file
I'm trying to parse a very large JSON string in Unity. I do not need all the fields and I can't create a class with all the members.
It appears that all examples I have found, including the official ...
0
votes
1
answer
1k
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
0
answers
244
views
JSON deserializing 'nested' Array
Greetings!
I'm working on a class that loads and parses .json files and returns information from the loaded .json, but I have problems reading the nested arrays of my .json files.
Turning the ...
0
votes
1
answer
112
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
447
views
Json Libgdx serialize / de-serialize a Object Map of Object Maps
Any one have any ideas on how I can serialize / de-serialize an
ObjectMap<Enum, ObjectMap<String, Object>>();
(Object is usually a String Integer ...
2
votes
1
answer
1k
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":[{},{},{},{},{},{},{},{},{},{},{}]}...
...
0
votes
0
answers
85
views
How do I add data to a Dictionary after I deserialize the data for the class?
I'm getting a null reference exception on "AddEmpireView()" and I cannot figure it out for the life of me. Here's the class:
...
0
votes
1
answer
947
views
JsonUtility is throwing exception when there is \" in the string
The following is my JSON file:
...
0
votes
0
answers
71
views
Facing issues trying to Parse JSON in Lua
Problem statement:
Need help trying to load a JSON file into a table array in Lua for Corona SDK development.
My Objective:
Call specific data from JSON file to my application by using key value ...
0
votes
0
answers
64
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
2
answers
888
views
Unity - Save/load in a sandbox game, how to instantiate saved objects
I have a game where a player can place GameObjects.
I can save/load this GameObjects data with using JSON, for example its position, but I cannot think of a good way to tell my save-file (and my ...
0
votes
1
answer
1k
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 ...
0
votes
1
answer
593
views
Get JSON property dynamically in Unity C#?
I'm saving game data into JSON, however basically I can't get property with just string just like in JavaScript.
This makes my code to write so many if/switch statements, looks very not clean, hard ...
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
347
views
unity 3d loading data from json problem
i am trying to practice on loading data from json files my problem is about when i try to load the sprite path from the json file to load the image icon from the floder that contain it, i manged to do ...
1
vote
1
answer
175
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 ...
4
votes
6
answers
15k
views
unity JsonUtility.ToJson returns empty string
I am trying to use Unity's built in json serialization. It produces empty string. I do not understand why. (I was trying to use NewtonSoft Json.Net but that wasn't working either even though I was ...
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:
...
1
vote
1
answer
365
views
Godot: does parse_json accept multiple JSON objects?
If I had a JSON file that had multiple objects, can the method read through without some form of exception?
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 ...
0
votes
1
answer
4k
views
Trying to load .json questions and answers into a multiple-choice quiz game in Unity [duplicate]
I am developing a Unity game which includes a multiple-choice quiz.
I've placed what I believe is a properly-formatted .json file (the quiz question, four answer choices, the correct answer, and an ...
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 ...
1
vote
5
answers
13k
views
Parse JSON in Unity
I've this JSON code like below. How do I parse it to the objects on code below?
...
0
votes
1
answer
352
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 ...
1
vote
1
answer
5k
views
JSON Parse (Invalid Value)
My settings.json (generated with JsonUtility.ToJson):
{
"masterVolume": 0.10000000149011612,
"fullScreenMode": 1,
"cheatsEnabled": false
}
Offending ...
2
votes
1
answer
567
views
LibGDX Json writes only part of class
Hello I've been developing this game for awhile and now trying to implement save data via Json.
I've gotten to where when the app is first launched it will write the Json file with the variables I ...
1
vote
1
answer
1k
views
ds_map_find_value returning number instead of array
Currently messing around on how to make a text engine in GameMaker and figured I would hold all my conversations in JSON format stored in a .txt file, which I'll convert into a ds_map and draw the ...
1
vote
0
answers
70
views
Creating Customization System in Unity
I'm making a game with customization system for both characters and weapons and I don't know exactly what's the best way of doing the customizations themselves.
I'm thinking of creating separate ...
0
votes
1
answer
205
views
Instantiate a sprite using json data value (C# Unity)
Here is my code :
BetBoard_Test.cs
...