Rhino.NativeJSON.Ja C# (CSharp) Method

Ja() private static method

private static Ja ( NativeArray value, NativeJSON state ) : string
value NativeArray
state NativeJSON
return string
		private static string Ja(NativeArray value, NativeJSON.StringifyState state)
		{
			if (state.stack.Search(value) != -1)
			{
				throw ScriptRuntime.TypeError0("msg.cyclic.value");
			}
			state.stack.Push(value);
			string stepback = state.indent;
			state.indent = state.indent + state.gap;
			IList<object> partial = new List<object>();
			long len = value.GetLength();
			for (long index = 0; index < len; index++)
			{
				object strP;
				if (index > int.MaxValue)
				{
					strP = Str(System.Convert.ToString(index), value, state);
				}
				else
				{
					strP = Str((int)index, value, state);
				}
				if (strP == Undefined.instance)
				{
					partial.Add("null");
				}
				else
				{
					partial.Add(strP);
				}
			}
			string finalValue;
			if (partial.IsEmpty())
			{
				finalValue = "[]";
			}
			else
			{
				if (state.gap.Length == 0)
				{
					finalValue = '[' + Join(partial, ",") + ']';
				}
				else
				{
					string separator = ",\n" + state.indent;
					string properties = Join(partial, separator);
					finalValue = "[\n" + state.indent + properties + '\n' + stepback + ']';
				}
			}
			state.stack.Pop();
			state.indent = stepback;
			return finalValue;
		}