예제 #1
0
		/// <summary>
		/// Produce a comma delimited text from a JSONArray of JSONObjects using
		/// a provided list of names.
		/// </summary>
		/// <remarks>
		/// Produce a comma delimited text from a JSONArray of JSONObjects using
		/// a provided list of names. The list of names is not included in the
		/// output.
		/// </remarks>
		/// <param name="names">A JSONArray of strings.</param>
		/// <param name="ja">A JSONArray of JSONObjects.</param>
		/// <returns>A comma delimited text.</returns>
		/// <exception cref="JSONException"/>
		/// <exception cref="org.json.JSONException"/>
		public static string ToString(org.json.JSONArray names, org.json.JSONArray ja)
		{
			if (names == null || names.Length() == 0)
			{
				return null;
			}
			System.Text.StringBuilder sb = new System.Text.StringBuilder();
			for (int i = 0; i < ja.Length(); i += 1)
			{
				org.json.JSONObject jo = ja.OptJSONObject(i);
				if (jo != null)
				{
					sb.Append(RowToString(jo.ToJSONArray(names)));
				}
			}
			return sb.ToString();
		}
예제 #2
0
		/// <summary>Produce a comma delimited text from a JSONArray of JSONObjects.</summary>
		/// <remarks>
		/// Produce a comma delimited text from a JSONArray of JSONObjects. The
		/// first row will be a list of names obtained by inspecting the first
		/// JSONObject.
		/// </remarks>
		/// <param name="ja">A JSONArray of JSONObjects.</param>
		/// <returns>A comma delimited text.</returns>
		/// <exception cref="JSONException"/>
		/// <exception cref="org.json.JSONException"/>
		public static string ToString(org.json.JSONArray ja)
		{
			org.json.JSONObject jo = ja.OptJSONObject(0);
			if (jo != null)
			{
				org.json.JSONArray names = jo.Names();
				if (names != null)
				{
					return RowToString(names) + ToString(names, ja);
				}
			}
			return null;
		}