Search Unity

json parsing w/ JsonFx

Discussion in 'iOS and tvOS' started by mindlube, Feb 24, 2011.

  1. mindlube

    mindlube

    Joined:
    Oct 3, 2008
    Posts:
    993
    JsonFx seems to be well recommended for Unity iOS, from a search of forum posts. I just grabbed JsonFx v2.0 and noticed that just using JsonReader and JsonWriter adds System.Xml dependency :(

    Mono.Security.dll
    System.Xml.dll
    System.dll
    mscorlib.dll
    JsonFx.dll
    Assembly-CSharp.dll

    I was wondering if anyone has tried building a stripped down version of JsonFx 2.0 for use with Unity?

    edit: actually System.Xml.dll is pretty small. I thought it was like 1.2MB. maybe b/c i have build stripping in Pro?
     
  2. mindlube

    mindlube

    Joined:
    Oct 3, 2008
    Posts:
    993
    NOOOOOOOO. sigh

    ExecutionEngineException: Attempting to JIT compile method 'JsonFx.Serialization.DataReader`1<JsonFx.Model.ModelTokenType>:Read<System.Collections.Generic.Dictionary`2<string, object>> (string)' while running with --aot-only.

    at NewBehaviourScript.Start () [0x00000] in <filename unknown>:0
     
  3. mckamey

    mckamey

    Joined:
    Dec 13, 2010
    Posts:
    10
    I wrote a reply to this a week ago but it apparently didn't post.

    The need for System.Xml is only to support the XML Serialization attributes. If you don't need these, a build would be easy to produce which didn't have that dependency.

    Also there is probably a subset of the JsonFx v2 source that could be built which would be betters suited to this environment. I'm not familiar with Unity enough but there is certainly a lot of flexibility written into JsonFx v2 which is not critical to JSON serialization.
     
  4. mindlube

    mindlube

    Joined:
    Oct 3, 2008
    Posts:
    993
    The XML dependency is a minor issue, and as you mention is is possible to strip out classes and dependencies.

    The real problem is that for Unity on iOS, it runs in Mono's AOT mode, which is extremely unfriendly toward serialization with Generics, particularly Generics of non-string types. After trying pretty much every serialization method available for C# on iOS, and having all of them throw JIT errors at runtime, I eventually settled on https://github.com/ServiceStack/ServiceStack.Text

    This has the advantage of being extremely fast, working over RPC methods as well as serializing data to PlayerPrefs. But on iOS one must use string types such as Dictionary<string,string> and List<string> for example.
     
  5. mckamey

    mckamey

    Joined:
    Dec 13, 2010
    Posts:
    10
    I should mention that I'm the developer of JsonFx.

    If I knew the constraints of Mono's AOT mode, I'd be able to produce a build that was more suitable for Unity on iOS. I've seen a lot of people using JsonFx on here but I've never actually made a build specifically for Unity.

    If anyone has any better direction for what needs to change to make it work better on Unity, I'd be happy to try to produce a build for it.
     
  6. mindlube

    mindlube

    Joined:
    Oct 3, 2008
    Posts:
    993
    mckamey, OK thanks for the info and for JsonFx too! Just to clarify, I think the AOT JIT Errors would arise only running under iOS player. Targeting other Unity platforms such as Win, Mac, webplayer, etc. should not have this issue.
     
  7. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    Don't use reflection for data parsing (ie json <-> object), parse the Json manually, thats working.
    On AOT, these automagic reflection are severely limited


    as for System.XML: thats standard, most Json / tree parsers you will find in .NET rely on system xml for one or more aspects
     
    Last edited: Mar 9, 2011
  8. mckamey

    mckamey

    Joined:
    Dec 13, 2010
    Posts:
    10
    No reflection is needed for deserialization. That is simply reading the JSON text. Reflection is typically used when serializing POCO to JSON.

    JsonFx doesn't rely on System.Xml for anything but the serialization attributes that are pretty commonly used. If you don't use those attributes on your model objects, then you have no need for System.Xml.dll.
     
  9. gamma.psh

    gamma.psh

    Joined:
    Jan 25, 2011
    Posts:
    44
    Sry for waking up this old thread, but this is still a problem for me :(

    Has someone a working version of JsonFx, I get it working in editor and Webplayer but not on iOS.
    Beside a lot of Warnings that testing against null does't work and other small stuff, whats not really nice to have so much warning spamm, it's running in Editor, as said above.

    But on iOS i have 2 Problems, stripping with mscorelib is not working. And as dreamora said Object <-> Json parsing is not working.
    But what is working? What is needed to get a Json representation of an Object Array?

    I need to get some Objects with string and number propperties to Json for Device <-> Server communication, something similar to the example here:

    [{"name":"Jon","age":15.2,"someInt":1,"friends":["Fred","Fredine","Fredchen"]},{"name":"Jane","age":18,"someInt":3,"friends":["Franz","Franzie","Franzchen"]}]

    Thx for advice
     
  10. gulgi

    gulgi

    Joined:
    Apr 18, 2012
    Posts:
    9
    Still doesn't work on the iPhone. :/

    I get loads of these when trying: System.MissingMethodException: Method not found: 'Default constructor not found...ctor() of System.ComponentModel.Int32Converter'.

    If you have an updated/(iOS)working version, it would be..AWESOME.

    Thx
     
  11. mindlube

    mindlube

    Joined:
    Oct 3, 2008
    Posts:
    993
  12. Deleted User

    Deleted User

    Guest

    Just in case people are still digging about this here's how I fixed it by creating the file Assets/link.xml with the following contents:

    Code (csharp):
    1.  
    2. <linker>
    3.   <assembly fullname="System">
    4.     <type fullname="System.ComponentModel.CharConverter" preserve="all"/>
    5.     <type fullname="System.ComponentModel.ByteConverter" preserve="all"/>
    6.     <type fullname="System.ComponentModel.SByteConverter" preserve="all"/>
    7.     <type fullname="System.ComponentModel.Int16Converter" preserve="all"/>
    8.     <type fullname="System.ComponentModel.UInt16Converter" preserve="all"/>
    9.     <type fullname="System.ComponentModel.Int32Converter" preserve="all"/>
    10.     <type fullname="System.ComponentModel.UInt32Converter" preserve="all"/>
    11.     <type fullname="System.ComponentModel.Int64Converter" preserve="all"/>
    12.     <type fullname="System.ComponentModel.UInt64Converter" preserve="all"/>
    13.     <type fullname="System.ComponentModel.DoubleConverter" preserve="all"/>
    14.     <type fullname="System.ComponentModel.DecimalConverter" preserve="all"/>
    15.     <type fullname="System.ComponentModel.SingleConverter" preserve="all"/>
    16.   </assembly>
    17. </linker>
    18.  
    Hope it helps.
     
    Last edited by a moderator: Jun 4, 2012
  13. gulgi

    gulgi

    Joined:
    Apr 18, 2012
    Posts:
    9
    It did!
    Thank you!! ^__^
     
  14. marjan

    marjan

    Joined:
    Jun 6, 2009
    Posts:
    563
    While the link.xml tip was working for me i ran into another problem.

    I have Build in Array of a small class. This way i can fill the array within unity. custom class is

    Code (csharp):
    1. [System.Serializable]
    2. public class Level {
    3.     public bool locked = true;
    4.     public bool played = false;
    5.     public int lastPlayerPoints{get;set;}
    6.     public int achievedStars{get;set;}
    7.     public string sceneName;
    8. }
    Now the weird thing. This is iOS only and only happens on the device. I serialize the Array onApplicationPause like this:

    Code (csharp):
    1. void OnApplicationPause (bool pause) {
    2.         Debug.Log("*** OnApplicationPause ***************************");
    3.        if(pause) {
    4.             Debug.Log("*** we got to pause and want to save ***********************");
    5.            // we are in background
    6.             saveLevelProgressToTextFile(1);
    7.        } else {
    8.             Debug.Log("*** we resume the game ***********************");
    9.            // we are in foreground again.
    10.        }
    11.     }
    12. void saveLevelProgressToTextFile (int world) {
    13.         Debug.Log("******** saveLevelProgressToTextFile ********");
    14.         string fileName = "w"+world+"progress.txt";
    15.         // this turns a C# object into a JSON string.
    16.        
    17.         Debug.Log("******** fileName = " + fileName);
    18.        
    19.        
    20.         Debug.Log("******** Checking directory to save to");
    21.         if(!Directory.Exists(Application.persistentDataPath+"/LevelProgress")){
    22.             Debug.Log("Creating LevelProgress Folder");
    23.             Directory.CreateDirectory(Application.persistentDataPath+"/LevelProgress");
    24.            
    25.         } else {
    26.             Debug.Log("LevelProgress Folder Exists");  
    27.         }
    28.        
    29.         //wir öffnen einen neuen StreamWriter
    30.         string fullPath = Application.persistentDataPath +"/LevelProgress/" + fileName;
    31.         Debug.Log("try to save " + fullPath);
    32.        
    33.    
    34.             Debug.Log("trying to serialize world1Levels = " + world1Levels);
    35.             string levelDataJSON = JsonWriter.Serialize(world1Levels);
    36.             Debug.Log("******** levelDataJSON = " + levelDataJSON);
    37.            
    38.            
    39.             StreamWriter sw = new StreamWriter(fullPath);
    40.    
    41.             sw.WriteLine(levelDataJSON);
    42.             sw.Flush();
    43.             sw.Close();
    44.             //damit schliessen wir den StreamWriter
    45.             if(File.Exists(fullPath)){
    46.               print("File " + fileName + " written!");
    47.             } else{
    48.               Debug.LogWarning("Error writing file " + fileName);
    49.             }
    50.  
    51.        
    52.     }
    53.  
    I am testing this with Xcode. I run the app, and hit the home Button. OnApplicationPause gets fired, serialzes, saves and all is well.
    I hit the app icon again, app resumes, file gets read in and desiriales. All is well.
    But...
    if i hit the home button a second time now it crashes on save. Always.

    XCode gives me this:

    Code (csharp):
    1. try to save /var/mobile/Applications/4D3BBA14-06FC-40CC-9B92-054399455623/Documents/LevelProgress/w1progress.txt
    2.  
    3. (Filename: /Applications/buildAgent/work/d9c061b1c154f5ae/Runtime/ExportGenerated/iPhonePlayer-armv7/UnityEngineDebug.cpp Line: 43)
    4.  
    5. trying to serialize world1Levels = Level[]
    6.  
    7. (Filename: /Applications/buildAgent/work/d9c061b1c154f5ae/Runtime/ExportGenerated/iPhonePlayer-armv7/UnityEngineDebug.cpp Line: 43)
    8.  
    9. System.String doesn't implement interface System.Collections.IEnumerator
    10. * Assertion: should not be reached at mini-trampolines.c:183
    11.  
    12. (lldb)
    13.  
    I have no idea why. Only reason could be that on the first desiralisation either the class instances get messed up somehow, or their values have internal type issues.
    I am currently lost in the dark :confused:
     
    Last edited: Sep 16, 2012
  15. Burletech

    Burletech

    Joined:
    Jul 1, 2010
    Posts:
    73

    I am also having this problem on iOS. Everything works fine on OSX in the editor but the application crashes when running on the device. The issue comes when I serialize. Did you happen to find any fix for it? Thanks! - Josh
     
  16. gulgi

    gulgi

    Joined:
    Apr 18, 2012
    Posts:
    9
    I had the exact same error as well. mini-trampoline.c...

    I finally got fed up and started using LitJson. Added all the functionality missing from it.. and using that instead.
    When this project is done, I do plan on uploading my changes to the project. (When I have time to clean it up.)

    The main thing it is lacking is it doesn't support ignore properties. No rename property. And if I remember correctly, it serializes statics as well..

    I did find this a while back: https://bitbucket.org/TowerOfBricks/jsonfx-for-unity3d/src/ They seem to have continued to work on JsonFX.. too late for me to see if they have fixed that mini-trampoline, but if any of you try it out, please report on you success/failure with this!
     
  17. Deleted User

    Deleted User

    Guest

    Does it help with the following?

    Code (csharp):
    1.  
    2.   <assembly fullname="System">
    3.     <type fullname="System.ComponentModel.ArrayConverter" preserve="all"/>
    4.     <type fullname="System.ComponentModel.BaseNumberConverter" preserve="all"/>
    5.     <type fullname="System.ComponentModel.BooleanConverter" preserve="all"/>
    6.     <type fullname="System.ComponentModel.ByteConverter" preserve="all"/>
    7.     <type fullname="System.ComponentModel.CharConverter" preserve="all"/>
    8.     <type fullname="System.ComponentModel.CollectionConverter" preserve="all"/>
    9.     <type fullname="System.ComponentModel.ComponentConverter" preserve="all"/>
    10.     <type fullname="System.ComponentModel.CultureInfoConverter" preserve="all"/>
    11.     <type fullname="System.ComponentModel.DateTimeConverter" preserve="all"/>
    12.     <type fullname="System.ComponentModel.DecimalConverter" preserve="all"/>
    13.     <type fullname="System.ComponentModel.DoubleConverter" preserve="all"/>
    14.     <type fullname="System.ComponentModel.EnumConverter" preserve="all"/>
    15.     <type fullname="System.ComponentModel.ExpandableObjectConverter" preserve="all"/>
    16.     <type fullname="System.ComponentModel.Int16Converter" preserve="all"/>
    17.     <type fullname="System.ComponentModel.Int32Converter" preserve="all"/>
    18.     <type fullname="System.ComponentModel.Int64Converter" preserve="all"/>
    19.     <type fullname="System.ComponentModel.NullableConverter" preserve="all"/>
    20.     <type fullname="System.ComponentModel.SByteConverter" preserve="all"/>
    21.     <type fullname="System.ComponentModel.SingleConverter" preserve="all"/>
    22.     <type fullname="System.ComponentModel.StringConverter" preserve="all"/>
    23.     <type fullname="System.ComponentModel.TimeSpanConverter" preserve="all"/>
    24.     <type fullname="System.ComponentModel.UInt16Converter" preserve="all"/>
    25.     <type fullname="System.ComponentModel.UInt32Converter" preserve="all"/>
    26.     <type fullname="System.ComponentModel.UInt64Converter" preserve="all"/>
    27.   </assembly>
    28.  
    By the way, I have used LitJson in the past and the reason I switched to JsonFx was because I remember having stack problems when deserializing not-so-deeply-nested structures (like 3 or 4 levels or so). There would be an exception telling me stack stack is insufficient or something like that.
     
  18. gulgi

    gulgi

    Joined:
    Apr 18, 2012
    Posts:
    9
    This would probably be cause LitJson serializes statics as well.. so serializing singletons ==> recursive loop. ;)

    I will check with the above finding; thank you!

    (We still use JsonFX for reading JSON.. and: very late in this project, JsonFX refused to parse a List of int:s all of a sudden.. changing to uint worked. (ints > 0 and < 35..), so anything more stable would be..welcome. I do hope they have something better/more stable for Unity4)
     
  19. nerophon

    nerophon

    Joined:
    Aug 8, 2009
    Posts:
    35
    Code (csharp):
    1. System.String doesn't implement interface System.Collections.IEnumerator
    2. * Assertion: should not be reached at mini-trampolines.c:183
    This is a problem for us too. We're using LitJson.

    The problem goes away on test devices when we remove some of our log statements. Some of these statements have JsonData.ToJson() in them ( object --> string ), but we are not satisfied at all that this is the culprit because it is used throughout the project and does not appear to use reflection. Other possible culprits include the use of JsonMapper.ToObject(), however this is used fairly often and is not used in any log statements (which would make no sense). I also cannot find any use of Reflection in the class.

    We are continuing to test, and hoping to discover more precisely what the issues are. In the meantime, if anyone has any concrete information, that would be extremely helpful. Properly debugging this issue is nightmarish at the moment, because of the way trampolines work and the lack of solid information on the web concerning precisely what causes trampolines to be required in an AOT build.

    In fact, we are even confused about how trampolines are relevant at all here: since iOS requires AOT, doesn't that mean that the JIT doesn't run? And if so, how are trampolines used? Sure, they are pre-allocated at compile-time, but surely to be used at runtime the JIT must in some sense be running?

    Furthermore, upping the number of each type of trampoline in the AOT settings appears to have no effect whatsoever upon the issue.
     
    Last edited: Jan 7, 2013
  20. gulgi

    gulgi

    Joined:
    Apr 18, 2012
    Posts:
    9
    At some point, we got around our trampoline-issues by removing a few calls to Debug.Log.

    But the crashes (mini-trampolines..) started happening in or around serialization-code, and often NOT the first time the code was run.

    So.. well, I am confused as well. ATM we do not have any such crash, but with the randomness of it...? :/ *fingers crossed*
     
  21. Bovine

    Bovine

    Joined:
    Oct 13, 2010
    Posts:
    195
    How are you getting the ServiceStack.Text to compile? I see lots of error surrounding missing DataContractAttribute
     
  22. gulgi

    gulgi

    Joined:
    Apr 18, 2012
    Posts:
    9
    Was this a question to me..? If so; I have no idea what you are talking about. ^_^
     
  23. TokyoDan

    TokyoDan

    Joined:
    Jun 16, 2012
    Posts:
    1,080
    Does MiniJSON.cs work with two dimensional arrays?
     
  24. Nakano37

    Nakano37

    Joined:
    Jan 13, 2011
    Posts:
    7
    People were looking for a stack trace of what happens when you try to use JsonFX with iOS.. here's what happens when I try to use the newest JsonFX dll on iOS to deserialize a large json blob to a series of nested classes using reflection:

    Code (csharp):
    1.  
    2. Failed to deserialize JsonFx.Serialization.DeserializationException: Attempting to JIT compile method '(wrapper dynamic-method) object: (object)' while running with --aot-only.
    3.  ---> System.ExecutionEngineException: Attempting to JIT compile method '(wrapper dynamic-method) object: (object)' while running with --aot-only.
    4.  
    5.   at System.Delegate.CreateDelegate (System.Type type, System.Object firstArgument, System.Reflection.MethodInfo method, Boolean throwOnBindFailure) [0x00000] in <filename unknown>:0
    6.   at System.Delegate.CreateDelegate (System.Type type, System.Reflection.MethodInfo method, Boolean throwOnBindFailure) [0x00000] in <filename unknown>:0
    7.   at System.Delegate.CreateDelegate (System.Type type, System.Reflection.MethodInfo method) [0x00000] in <filename unknown>:0
    8.   at System.Reflection.Emit.DynamicMethod.CreateDelegate (System.Type delegateType) [0x00000] in <filename unknown>:0
    9.   at JsonFx.CodeGen.DynamicMethodGenerator.GetPropertyGetter (System.Reflection.PropertyInfo propertyInfo) [0x00000] in <filename unknown>:0
    10.   at JsonFx.Serialization.Resolvers.MemberMap..ctor (System.Reflection.PropertyInfo propertyInfo, DataName dataName, JsonFx.Serialization.Resolvers.ValueIgnoredDelegate isIgnored) [0x00000] in <filename unknown>:0
    11.   at JsonFx.Serialization.Resolvers.ResolverCache.BuildMap (System.Type objectType, IDictionary`2 maps) [0x00000] in <filename unknown>:0
    12.   at JsonFx.Serialization.Resolvers.ResolverCache.LoadMaps (System.Type type) [0x00000] in <filename unknown>:0
    13.   at JsonFx.Model.ModelAnalyzer.ConsumeObject (IStream`1 tokens, System.Type targetType) [0x00000] in <filename unknown>:0
    14.   at JsonFx.Model.ModelAnalyzer.ConsumeValue (IStream`1 tokens, System.Type targetType) [0x00000] in <filename unknown>:0
    15.   at JsonFx.Model.ModelAnalyzer+<Analyze>d__0.MoveNext () [0x00000] in <filename unknown>:0
    16.   at JsonFx.Serialization.DataReader`1[JsonFx.Model.ModelTokenType].ReadSingle (ITextTokenizer`1 tokenizer, IEnumerable`1 tokens, System.Type targetType) [0x00000] in <filename unknown>:0
    17.   --- End of inner exception stack trace ---
    18.   at JsonFx.Serialization.DataReader`1[JsonFx.Model.ModelTokenType].ReadSingle (ITextTokenizer`1 tokenizer, IEnumerable`1 tokens, System.Type targetType) [0x00000] in <filename unknown>:0
    19.   at JsonFx.Serialization.DataReader`1[JsonFx.Model.ModelTokenType].Read (System.String input, System.Type targetType) [0x00000] in <filename unknown>:0
    20.   at JSON.Deserialize (System.String input, System.Type targetType) [0x00000] in <filename unknown>:0 , 1, 0, (very very long message)
    21.  
    Anyone have any thoughts on how to get around that? Deserialization works going from JSON->Dictionary<string, object>, but I would like to avoid that intermediary step by going directly to the objects that the JSON represents. It works great on Mac/PC, but not on iOS... I've tried the link.xml stuff mentioned elsewhere in this thread, and it doesn't seem to solve this.

    -Ryan
     
  25. yotes

    yotes

    Joined:
    Mar 18, 2012
    Posts:
    15
    Ok, I'm facing the same problem.. and I got no clue of why it happens :(

    System.String doesn't implement interface System.Collections.IEnumerator
    * Assertion: should not be reached at mini-trampolines.c:183




    Can't figure out any solution yet :(
     
  26. mgeorgoulopoulos

    mgeorgoulopoulos

    Joined:
    Aug 24, 2009
    Posts:
    66
    Has anybody had the chance to figure out a solution for this?
    Code (csharp):
    1. System.String doesn't implement interface System.Collections.IEnumerator
    2. * Assertion: should not be reached at mini-trampolines.c:183
    It seems to be very random, it just throws the exception 1-2 times every 10 game starts.

    Any help will be grateful!
     
  27. Theron

    Theron

    Joined:
    Dec 10, 2012
    Posts:
    1
    That solved my problem too! Thanks!
     
  28. keomanla

    keomanla

    Joined:
    Jan 30, 2012
    Posts:
    26


    This does not solved the bug "System.String doesn't implement interface System.Collections.IEnumerator" crash

    Instead just need to remove all Debug.log about the object you are going to Serialize.

    For example if you are going to use JsonFx to Serialize() a IDictionary or a Hashtable, avoid having Debug.log which receive IDictionary/Hashtable or its keys/values as parameter.

    Of course you might curios to know if whatever will Serialize is correct or not, my suggestion is to Debug.Log the result string from Serialize(). Before calling Serialize(), don't Debug.Log the object.

    There might be something wrong with Debug.Log in this specific case.

    Hope this helps.
     
  29. Voronoi

    Voronoi

    Joined:
    Jul 2, 2012
    Posts:
    585
    I am trying to use the JsonFX library to parse Twitter feeds and I keep getting the error:

    This is the code that I'm using based on the demo:

    Code (CSharp):
    1. var search = JsonReader.Deserialize<TwitterSearchResults> (rawJson);
    And this is the rawJson text that is returned from a Twitter search:

    Code (CSharp):
    1.  
    2. {
    3.     "statuses": [
    4.         {
    5.             "metadata": {
    6.                 "iso_language_code": "en",
    7.                 "result_type": "recent"
    8.             },
    9.             "created_at": "Sat Dec 20 00:19:47 +0000 2014",
    10.             "id": 546097597551628300,
    11.             "id_str": "546097597551628289",
    12.             "text": "RT @The_YUNiversity: If you want to remember what #vocabulary words mean, make as many mnemonics as possible. \n\n http://t.co/2GfszGnuNl …",
    13.             "source": "<a href=\"http://twitter.com/download/android\" rel=\"nofollow\">Twitter for Android</a>",
    14.             "truncated": false,
    15.             "in_reply_to_status_id": null,
    16.             "in_reply_to_status_id_str": null,
    17.             "in_reply_to_user_id": null,
    18.             "in_reply_to_user_id_str": null,
    19.             "in_reply_to_screen_name": null,
    20.             "user": {
    21.                 "id": 98570570,
    22.                 "id_str": "98570570",
    23.                 "name": "tRi3",
    24.                 "screen_name": "trulicious",
    25.                 "location": "soundcloud.com/trulicious",
    26.                 "profile_location": null,
    27.                 "description": "Just 60% from avatar. Busy being happy. Instagram: trulicious.",
    28.                 "url": "http://t.co/TQkoQU9o0t",
    29.                 "entities": {
    30.                     "url": {
    31.                         "urls": [
    32.                             {
    33.                                 "url": "http://t.co/TQkoQU9o0t",
    34.                                 "expanded_url": "http://trulicious.tumblr.com",
    35.                                 "display_url": "trulicious.tumblr.com",
    36.                                 "indices": [
    37.                                     0,
    38.                                     22
    39.                                 ]
    40.                             }
    41.                         ]
    42.                     },
    43.                     "description": {
    44.                         "urls": []
    45.                     }
    46.                 },
    47.                 "protected": false,
    48.                 "followers_count": 369,
    49.                 "friends_count": 401,
    50.                 "listed_count": 7,
    51.                 "created_at": "Tue Dec 22 06:42:33 +0000 2009",
    52.                 "favourites_count": 182,
    53.                 "utc_offset": 25200,
    54.                 "time_zone": "Jakarta",
    55.                 "geo_enabled": false,
    56.                 "verified": false,
    57.                 "statuses_count": 30276,
    58.                 "lang": "en",
    59.                 "contributors_enabled": false,
    60.                 "is_translator": false,
    61.                 "is_translation_enabled": false,
    62.                 "profile_background_color": "E7E9F5",
    63.                 "profile_background_image_url": "http://pbs.twimg.com/profile_background_images/669628408/20a0af00a0c0f38baa59c4d9849c3bc4.jpeg",
    64.                 "profile_background_image_url_https": "https://pbs.twimg.com/profile_background_images/669628408/20a0af00a0c0f38baa59c4d9849c3bc4.jpeg",
    65.                 "profile_background_tile": false,
    66.                 "profile_image_url": "http://pbs.twimg.com/profile_images/542551536828555264/LPOnSXda_normal.jpeg",
    67.                 "profile_image_url_https": "https://pbs.twimg.com/profile_images/542551536828555264/LPOnSXda_normal.jpeg",
    68.                 "profile_banner_url": "https://pbs.twimg.com/profile_banners/98570570/1411423406",
    69.                 "profile_link_color": "2FC2EF",
    70.                 "profile_sidebar_border_color": "FFFFFF",
    71.                 "profile_sidebar_fill_color": "252429",
    72.                 "profile_text_color": "666666",
    73.                 "profile_use_background_image": true,
    74.                 "default_profile": false,
    75.                 "default_profile_image": false,
    76.                 "following": false,
    77.                 "follow_request_sent": false,
    78.                 "notifications": false
    79.             },
    80.             "geo": null,
    81.             "coordinates": null,
    82.             "place": null,
    83.             "contributors": null,
    84.             "retweeted_status": {
    85.                 "metadata": {
    86.                     "iso_language_code": "en",
    87.                     "result_type": "recent"
    88.                 },
    89.                 "created_at": "Sat Dec 20 00:00:18 +0000 2014",
    90.                 "id": 546092692229201900,
    91.                 "id_str": "546092692229201920",
    92.                 "text": "If you want to remember what #vocabulary words mean, make as many mnemonics as possible. \n\n http://t.co/2GfszGnuNl http://t.co/KXtW6Vc8mQ",
    93.                 "source": "<a href=\"https://about.twitter.com/products/tweetdeck\" rel=\"nofollow\">TweetDeck</a>",
    94.                 "truncated": false,
    95.                 "in_reply_to_status_id": null,
    96.                 "in_reply_to_status_id_str": null,
    97.                 "in_reply_to_user_id": null,
    98.                 "in_reply_to_user_id_str": null,
    99.                 "in_reply_to_screen_name": null,
    100.                 "user": {
    101.                     "id": 217477505,
    102.                     "id_str": "217477505",
    103.                     "name": "Grammar YUNiversity",
    104.                     "screen_name": "The_YUNiversity",
    105.                     "location": "Writing our book in L.A.",
    106.                     "profile_location": null,
    107.                     "description": "Grammar bosses for Gen tl;dr. @IBGDRGN is our muse; @gerardway is our hero. We love YUNicorns. | \nhttp://t.co/Jo2cKRUuNF",
    108.                     "url": "http://t.co/8XWGuORgVw",
    109.                     "entities": {
    110.                         "url": {
    111.                             "urls": [
    112.                                 {
    113.                                     "url": "http://t.co/8XWGuORgVw",
    114.                                     "expanded_url": "http://www.TheYUNiversity.net",
    115.                                     "display_url": "TheYUNiversity.net",
    116.                                     "indices": [
    117.                                         0,
    118.                                         22
    119.                                     ]
    120.                                 }
    121.                             ]
    122.                         },
    123.                         "description": {
    124.                             "urls": [
    125.                                 {
    126.                                     "url": "http://t.co/Jo2cKRUuNF",
    127.                                     "expanded_url": "http://about.me/The_YUNiversity",
    128.                                     "display_url": "about.me/The_YUNiversity",
    129.                                     "indices": [
    130.                                         98,
    131.                                         120
    132.                                     ]
    133.                                 }
    134.                             ]
    135.                         }
    136.                     },
    137.                     "protected": false,
    138.                     "followers_count": 179887,
    139.                     "friends_count": 389,
    140.                     "listed_count": 631,
    141.                     "created_at": "Fri Nov 19 16:49:22 +0000 2010",
    142.                     "favourites_count": 13741,
    143.                     "utc_offset": -28800,
    144.                     "time_zone": "Pacific Time (US & Canada)",
    145.                     "geo_enabled": true,
    146.                     "verified": false,
    147.                     "statuses_count": 27684,
    148.                     "lang": "en",
    149.                     "contributors_enabled": false,
    150.                     "is_translator": false,
    151.                     "is_translation_enabled": false,
    152.                     "profile_background_color": "FFFFFF",
    153.                     "profile_background_image_url": "http://pbs.twimg.com/profile_background_images/495094833438941185/6CbwwhIn.png",
    154.                     "profile_background_image_url_https": "https://pbs.twimg.com/profile_background_images/495094833438941185/6CbwwhIn.png",
    155.                     "profile_background_tile": true,
    156.                     "profile_image_url": "http://pbs.twimg.com/profile_images/435657778913222656/2GUwf3MP_normal.png",
    157.                     "profile_image_url_https": "https://pbs.twimg.com/profile_images/435657778913222656/2GUwf3MP_normal.png",
    158.                     "profile_banner_url": "https://pbs.twimg.com/profile_banners/217477505/1414975099",
    159.                     "profile_link_color": "D9002D",
    160.                     "profile_sidebar_border_color": "FFFFFF",
    161.                     "profile_sidebar_fill_color": "DDEEF6",
    162.                     "profile_text_color": "333333",
    163.                     "profile_use_background_image": false,
    164.                     "default_profile": false,
    165.                     "default_profile_image": false,
    166.                     "following": false,
    167.                     "follow_request_sent": false,
    168.                     "notifications": false
    169.                 },
    170.                 "geo": null,
    171.                 "coordinates": null,
    172.                 "place": null,
    173.                 "contributors": null,
    174.                 "retweet_count": 4,
    175.                 "favorite_count": 8,
    176.                 "entities": {
    177.                     "hashtags": [
    178.                         {
    179.                             "text": "vocabulary",
    180.                             "indices": [
    181.                                 29,
    182.                                 40
    183.                             ]
    184.                         }
    185.                     ],
    186.                     "symbols": [],
    187.                     "user_mentions": [],
    188.                     "urls": [
    189.                         {
    190.                             "url": "http://t.co/2GfszGnuNl",
    191.                             "expanded_url": "http://bit.ly/ScexIO",
    192.                             "display_url": "bit.ly/ScexIO",
    193.                             "indices": [
    194.                                 95,
    195.                                 117
    196.                             ]
    197.                         },
    198.                         {
    199.                             "url": "http://t.co/KXtW6Vc8mQ",
    200.                             "expanded_url": "http://twitter.com/The_YUNiversity/status/546092692229201920/photo/1",
    201.                             "display_url": "pic.twitter.com/KXtW6Vc8mQ",
    202.                             "indices": [
    203.                                 118,
    204.                                 140
    205.                             ]
    206.                         }
    207.                     ]
    208.                 },
    209.                 "favorited": false,
    210.                 "retweeted": false,
    211.                 "possibly_sensitive": false,
    212.                 "lang": "en"
    213.             },
    214.             "retweet_count": 4,
    215.             "favorite_count": 0,
    216.             "entities": {
    217.                 "hashtags": [
    218.                     {
    219.                         "text": "vocabulary",
    220.                         "indices": [
    221.                             50,
    222.                             61
    223.                         ]
    224.                     }
    225.                 ],
    226.                 "symbols": [],
    227.                 "user_mentions": [
    228.                     {
    229.                         "screen_name": "The_YUNiversity",
    230.                         "name": "Grammar YUNiversity",
    231.                         "id": 217477505,
    232.                         "id_str": "217477505",
    233.                         "indices": [
    234.                             3,
    235.                             19
    236.                         ]
    237.                     }
    238.                 ],
    239.                 "urls": [
    240.                     {
    241.                         "url": "http://t.co/2GfszGnuNl",
    242.                         "expanded_url": "http://bit.ly/ScexIO",
    243.                         "display_url": "bit.ly/ScexIO",
    244.                         "indices": [
    245.                             116,
    246.                             138
    247.                         ]
    248.                     },
    249.                     {
    250.                         "url": "http://t.co/KXtW6Vc8mQ",
    251.                         "expanded_url": "http://twitter.com/The_YUNiversity/status/546092692229201920/photo/1",
    252.                         "display_url": "pic.twitter.com/KXtW6Vc8mQ",
    253.                         "indices": [
    254.                             139,
    255.                             140
    256.                         ]
    257.                     }
    258.                 ]
    259.             },
    260.             "favorited": false,
    261.             "retweeted": false,
    262.             "possibly_sensitive": false,
    263.             "lang": "en"
    264.         }
    265.     ],
    266.     "search_metadata": {
    267.         "completed_in": 0.022,
    268.         "max_id": 546097597551628300,
    269.         "max_id_str": "546097597551628289",
    270.         "next_results": "?max_id=546097597052891137&q=love&lang=en&count=10&include_entities=1",
    271.         "query": "love",
    272.         "refresh_url": "?since_id=546097597551628289&q=love&lang=en&include_entities=1",
    273.         "count": 10,
    274.         "since_id": 0,
    275.         "since_id_str": "0"
    276.     }
    277. }
    The code returns as valid JSON, so from all my digging I believe it is a problem with Unity converting the text format in an invalid way. The closest answer I could find is this older thread: http://forum.unity3d.com/threads/problem-converting-text-with-unescape-to-text-with-accents.108469/

    Will I need to loop through my results to eliminate improper characters? Is the problem the parsing of unusual characters like emoticons, or am I totally missing something here?