Json
How do I use Json
Below are practical examples compiled from projects for learning and reference purposes
Featured Snippets
File name: AccountService.cs
Copy
173 private void ParseResult(string result)
174 {
175 if (string.IsNullOrEmpty(result))
176 {
177 this.Message = "Server's response was empty. Please register through account website during this service interruption.";
178 return;
179 }
180
181 Dictionary
182 if (values == null)
183 {
184 this.Message = "Service temporarily unavailable. Please register through account website.";
185 return;
186 }
187
188 int returnCodeInt = -1;
189 string returnCodeString = string.Empty;
190 string message;
191
192 values.TryGetValue("ReturnCode", out returnCodeString);
193 values.TryGetValue("Message", out message);
194 int.TryParse(returnCodeString, out returnCodeInt);
195
196 this.ReturnCode = returnCodeInt;
197 if (returnCodeInt == 0)
198 {
199 // returnCode == 0 means: all ok. message is new AppId
200 this.AppId = message;
201 }
202 else
203 {
204 // any error gives returnCode != 0
205 this.AppId = string.Empty;
206 this.Message = message;
207 }
208 }
File name: VSCode.cs
Copy
231 {
232 get
233 {
234 return SettingsFolder + System.IO.Path.DirectorySeparatorChar + "launch.json";
235 }
236 }
File name: VSCode.cs
Copy
279 {
280
281 get
282 {
283 return SettingsFolder + System.IO.Path.DirectorySeparatorChar + "settings.json";
284 }
285 }
File name: FileHelper.cs
Copy
7 public static void Serialize(string name, object o) {
8 string json = JsonUtility.ToJson(o);
9 PlayerPrefs.SetString(name, json);
10 }
File name: FileHelper.cs
Copy
12 public static T Deserialize13 string json = PlayerPrefs.GetString(name);
14 return JsonUtility.FromJson
15 }
Json 132 lượt xem
Gõ tìm kiếm nhanh...