Click here to Skip to main content
15,885,170 members
Articles / Programming Languages / Markdown

APJSON

Rate me:
Please Sign up or sign in to vote.
4.67/5 (5 votes)
28 Aug 2013CPOL13 min read 41.6K   1.2K   34  
This is an alternative for "fastJSON"
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Apolyton.FastJson.Data;

namespace Apolyton.FastJson.Data
{
    /// <summary>
    /// Represents a json object.
    /// </summary>
    public interface IJsonValue
    {
        /// <summary>
        /// Gets the count of the members.
        /// </summary>
        /// <exception cref="InvalidOperationException">If item is not enumerable and has no count.</exception>
        int Count { get; }

        /// <summary>
        /// Gets the json value type.
        /// </summary>
        JsonType Type { get; }

        /// <summary>
        /// Gets the value at the specified index.
        /// </summary>
        /// <param name="i"></param>
        /// <returns></returns>
        /// <exception cref="InvalidOperationException">If item is not a json array.</exception>
        IJsonValue this[int i] { get; }

        /// <summary>
        /// Gets the key at the specified index.
        /// </summary>
        /// <param name="key"></param>
        /// <returns></returns>
        /// <exception cref="InvalidOperationException">If item is not a json object.</exception>s
        IJsonValue this[String key] { get; }

        /// <summary>
        /// Gets the value as string.
        /// </summary>
        String AsString { get; }

        /// <summary>
        /// Gets the value as integer.
        /// </summary>
        Int32 AsInteger { get; }

        /// <summary>
        /// Gets the value as double.
        /// </summary>
        Double AsDouble { get; }

        /// <summary>
        /// Gets the value as guid.
        /// </summary>
        Guid AsGuid { get; }
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Germany Germany
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions