User:Alexander Brazie
From Unify Community Wiki
Revision as of 00:33, 15 October 2016 by Alice Liang (Talk | contribs)
I'm here to fix a bug in the JSON Simple script for future users.
public override string ToJSON (int prefix) { string pre = new string (' ', (prefix) * 2); string s = new string (' ', (prefix + 1) * 2); string ret = "\n" + pre + "{"; var length = ret.Length; foreach (KeyValuePair<string,JSONNode> n in m_Dict) { if ( ret.Length > length ) ret += ", "; ret += "\n" + s; ret += string.Format ("\"{0}\": {1}", n.Key, n.Value.ToJSON (prefix + 1)); } ret += "\n" + pre + "}"; return ret; }
This is an improvement on the previous formatting. Yoroshiku~