Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8343531
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T06:05:34+00:00 2026-06-09T06:05:34+00:00

Using JsonFX I am loading a json stream into my application. The json uses

  • 0

Using JsonFX I am loading a json stream into my application. The json uses a URL for one of the objects inside, and so, using the default dynamic way of accessing the object doesn’t work, as some of the characters in the URL are not valid for a member name.
http://opendatacommunities.org/doc/geography/lsoa/E01004700.json

{
   'http://opendatacommunities.org/id/geography/lsoa/E01004700': {
      'http://data.ordnancesurvey.co.uk/ontology/spatialrelations/easting': [
         {
            type: 'literal',
            value: '526252',
            datatype: 'http://www.w3.org/2001/XMLSchema#integer'
         }
      ],
      'http://www.w3.org/2003/01/geo/wgs84_pos#lat': [
         {
            type: 'literal',
            value: '51.51349',
            datatype: 'http://www.w3.org/2001/XMLSchema#decimal'
         }
      ],
      'http://statistics.data.gov.uk/def/administrative-geography/district': [
         {
            type: 'uri',
            value: 'http://statistics.data.gov.uk/id/local-authority-district/00BK'
         }
      ],
      'http://opendatacommunities.org/def/geography#boundaryAsJSON': [
         {
            type: 'uri',
            value: 'http://opendatacommunities.org/lsoa_boundaries/E01004700.json'
         }
      ],
      'http://data.ordnancesurvey.co.uk/ontology/spatialrelations/northing': [
         {
            type: 'literal',
            value: '180964',
            datatype: 'http://www.w3.org/2001/XMLSchema#integer'
         }
      ],
      'http://www.w3.org/2003/01/geo/wgs84_pos#long': [
         {
            type: 'literal',
            value: '-0.18198',
            datatype: 'http://www.w3.org/2001/XMLSchema#decimal'
         }
      ],
      'http://www.w3.org/2004/02/skos/core#notation': [
         {
            type: 'literal',
            value: 'E01004700'
         }
      ],
      'http://www.w3.org/1999/02/22-rdf-syntax-ns#type': [
         {
            type: 'uri',
            value: 'http://opendatacommunities.org/def/geography#LSOA'
         }
      ],
      'http://www.w3.org/2000/01/rdf-schema#label': [
         {
            type: 'literal',
            value: 'Westminster 016E'
         }
      ],
      'http://www.w3.org/2002/07/owl#sameAs': [
         {
            type: 'uri',
            value: 'http://statistics.data.gov.uk/id/statistical-geography/E01004700'
         }
      ]
   }
} 

Is there a way that I can access this object?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T06:05:36+00:00Added an answer on June 9, 2026 at 6:05 am

    You can use the class of mine. Or go to Json.net .

     /// <summary>
    /// Class Name:JSONConvert
    /// Description:JSON Class as JAVA's
    /// Authors:ppgame (The deserialization part is by ppgame. The serialization part is from http://www.mzwu.com/)
    /// Email: ppgame.mit@gmail.com
    /// Date:2012-08-07
    /// </summary>
    public static class JSONConvert
    {
        #region Global Variables
        private static char[] _charary;
        private static int _aryend;
    
        #endregion
    
        #region JSON Deserialization
    
        /// <summary>
        /// Convert string to JSONObject
        /// </summary>
        /// <param name="text"></param>
        /// <returns></returns>
        private static JSONObject DeserializeSingletonObject(ref int left)
        {
            JSONObject localjson = new JSONObject();
            while (left <= _aryend)
            {
                char c = _charary[left];
                if (c == ' ' || c == '\r' || c == '\n' || c == '\t')  //skip empty char
                {
                    left++;
                    continue;
                }
                if (c == ',')
                {
                    left++;
                    continue;
                }
                char r = '\0';
                if (c == '\"' || c == '\'')     //beginning of key
                {
                    left++;
                    r = c;
                }
                else if (c == '}')      //end of JSONObject
                {
                    left++;
                    break;
                }
                int column = left;
                while (!((_charary[column] == r || r == '\0') && _charary[column - 1] != '\\' && _charary[column + 1] == ':')) column++;
                if (r == '\0') column++;
                string key = new string(_charary, left, column - left);         //get the key
                if (r == '\0')
                    left = column + 1;
                else
                    left = column + 2;
                c = _charary[left];
                while (c == ' ' || c == '\r' || c == '\n' || c == '\t')  //skip empty char
                {
                    left++;
                    c = _charary[left];
                }
                if (c == '\"' || c == '\'')     //if value is string
                {
                    left++;
                    int strend = left;
                    while (_charary[strend] != c || _charary[strend - 1] == '\\') strend++;
                    localjson[key] = new string(_charary, left, strend - left);
                    left = strend + 1;
                }
                else if (c == '{') // JSONObject
                {
                    left++;
                    localjson[key] = DeserializeSingletonObject(ref left);
                }
                else if (c == '[')     //JSONArray
                {
                    left++;
                    localjson[key] = DeserializeSingletonArray(ref left);
                }
                else
                {
                    //other class, such as boolean, int
                    //all are converted to string, it can be enriched if in need
                    int comma = left;
                    char co = _charary[comma];
                    while (co != ',' && co != '}')
                    {
                        comma++;
                        co = _charary[comma];
                    }
                    int em = comma - 1;
                    co = _charary[em];
                    while (co == ' ' || co == '\r' || co == '\n' || co == '\t')
                    {
                        em--;
                        co = _charary[em];
                    }
                    localjson[key] = new string(_charary, left, em - left + 1);
                    left = comma;
                }
            }
            return localjson;
        }
    
        /// <summary>
        /// Convert string to JSONArray
        /// </summary>
        /// <param name="text"></param>
        /// <returns></returns>
        private static JSONArray DeserializeSingletonArray(ref int left)
        {
            JSONArray jsary = new JSONArray();
            while (left <= _aryend)
            {
                char c = _charary[left];
                if (c == ' ' || c == '\r' || c == '\n' || c == '\t')  //skip empty char
                {
                    left++;
                    continue;
                }
                if (c == ',')
                {
                    left++;
                    continue;
                }
                if (c == ']')
                {
                    left++;
                    break;
                }
                if (c == '{') //JSONObject
                {
                    left++;
                    jsary.Add(DeserializeSingletonObject(ref left));
                }
                else if (c == '[')     //JSONArray
                {
                    left++;
                    jsary.Add(DeserializeSingletonArray(ref left));
                }
                else if (c == '\"' || c == '\'')            //string
                {
                    left++;
                    int strend = left;
                    while (_charary[strend] != c || _charary[strend - 1] == '\\') strend++;
                    jsary.Add(new string(_charary, left, strend - left));
                    left = strend + 1;
                }
                else
                {
                    //other class, such as boolean, int
                    //all are converted to string, it can be enriched if in need
                    int comma = left;
                    char co = _charary[comma];
                    while (co != ',' && co != ']')
                    {
                        comma++;
                        co = _charary[comma];
                    }
                    int em = comma - 1;
                    co = _charary[em];
                    while (co == ' ' || co == '\r' || co == '\n' || co == '\t')
                    {
                        em--;
                        co = _charary[em];
                    }
                    jsary.Add(new string(_charary, left, em - left + 1));
                    left = comma;
                }
            }
            return jsary;
        }
    
        #endregion
    
        #region Public Interface
    
        /// <summary>
        /// Get a JSONObject instance from char[]
        /// </summary>
        /// <param name="text"></param>
        /// <returns></returns>
        public static JSONObject DeserializeCharToObject(char[] input)
        {
            _charary = input;
            _aryend = _charary.Length - 1;
            while (_aryend > 0)
                if (_charary[_aryend] != '}')
                    _aryend--;
                else
                    break;
            int start = 0;
            while (start < _aryend)
                if (_charary[start] != '{')
                    start++;
                else
                    break;
            start++;
            if (_aryend < start + 1)
                return null;
            return DeserializeSingletonObject(ref start);
        }
    
        /// <summary>
        /// Get a JSONObject instance from string
        /// </summary>
        /// <param name="text"></param>
        /// <returns></returns>
        public static JSONObject DeserializeObject(string input)
        {
            return DeserializeCharToObject(input.ToCharArray());     //The first char must be '{'
        }
    
        /// <summary>
        /// Get a JSONArray instance from char[]
        /// </summary>
        /// <param name="text"></param>
        /// <returns></returns>
        public static JSONArray DeserializeCharsToArray(char[] input)
        {
            _charary = input;
            _aryend = _charary.Length - 1;
            while (_aryend > 0)
                if (_charary[_aryend] != ']')
                    _aryend--;
                else
                    break;
            int start = 0;
            while (start < _aryend)
                if (_charary[start] != '[')
                    start++;
                else
                    break;
            start++;
            if (_aryend < start + 1)
                return null;
            return DeserializeSingletonArray(ref start);
        }
    
        /// <summary>
        /// Get a JSONArray instance from string
        /// </summary>
        /// <param name="text"></param>
        /// <returns></returns>
        public static JSONArray DeserializeArray(string input)
        {
            return DeserializeCharsToArray(input.ToCharArray());
        }
        /// <summary>
        /// Serialize a JSONObject instance
        /// </summary>
        /// <param name="jsonObject"></param>
        /// <returns></returns>
        public static string SerializeObject(JSONObject jsonObject)
        {
            StringBuilder sb = new StringBuilder();
            sb.Append("{");
            foreach (KeyValuePair<string, object> kvp in jsonObject)
            {
                if (kvp.Value is JSONObject)
                {
                    sb.Append(string.Format("\"{0}\":{1},", kvp.Key, SerializeObject((JSONObject)kvp.Value)));
                }
                else if (kvp.Value is JSONArray)
                {
                    sb.Append(string.Format("\"{0}\":{1},", kvp.Key, SerializeArray((JSONArray)kvp.Value)));
                }
                else if (kvp.Value is string)
                {
                    sb.Append(string.Format("\"{0}\":\"{1}\",", kvp.Key, kvp.Value));
                }
                else
                {
                    sb.Append(string.Format("\"{0}\":\"{1}\",", kvp.Key, ""));
                }
            }
            if (sb.Length > 1)
                sb.Remove(sb.Length - 1, 1);
            sb.Append("}");
            return sb.ToString();
        }
    
        /// <summary>
        /// Serialize a JSONArray instance
        /// </summary>
        /// <param name="jsonArray"></param>
        /// <returns></returns>
        public static string SerializeArray(JSONArray jsonArray)
        {
            StringBuilder sb = new StringBuilder();
            sb.Append("[");
            for (int i = 0; i < jsonArray.Count; i++)
            {
                if (jsonArray[i] is JSONObject)
                {
                    sb.Append(string.Format("{0},", SerializeObject((JSONObject)jsonArray[i])));
                }
                else if (jsonArray[i] is JSONArray)
                {
                    sb.Append(string.Format("{0},", SerializeArray((JSONArray)jsonArray[i])));
                }
                else if (jsonArray[i] is string)
                {
                    sb.Append(string.Format("\"{0}\",", jsonArray[i]));
                }
                else
                {
                    sb.Append(string.Format("\"{0}\",", ""));
                }
    
            }
            if (sb.Length > 1)
                sb.Remove(sb.Length - 1, 1);
            sb.Append("]");
            return sb.ToString();
        }
        #endregion
    }
    
    /// <summary>
    /// Class Name:JSONObject
    /// Description:JSON Class
    /// Author:dnawo
    /// Website:http://www.mzwu.com/
    /// Date:2010-01-06
    /// Version:1.1.0
    /// </summary>
    public class JSONObject : Dictionary<string, object>
    {
        public void put(string key, string value)
        {
            this[key] = value;
        }
    
        public void put(string key, int value)
        {
            this[key] = value.ToString();
    
        }
    
    }
    
    /// <summary>
    /// Class Name:JSONArray
    /// Description:JSONArray Class
    /// Author:dnawo
    /// Website:http://www.mzwu.com/
    /// Date:2010-01-06
    /// Version:1.1.0
    /// </summary>
    public class JSONArray : List<object>
    { }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using mercurial, I've run into an odd problem where a line from one committer
Using IOS, I am trying to integrate the LinkedIn into the application. The integration
Using SQL Server 2008 R2 we are looking for a way to select the
Using Microsoft SQL Server 2005, is there any way to see when a table
Background .NET 4, C#, MVC3, using JsonFx to serialize and deserialize data. Base controller
I have recently gone into extending my site using node.js and have come to
Using jQuery, one can easily find out whether a particular element is visible using
using Interface Builder and Storyboared, I built UITabBarController with 3 views. By default, when
Background I am working on an application that requires the consumption of JSON services
Using Android TelephonyManager an application can obtain the state of data activity over the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.