Source/NFX/DataAccess/CRUD/Row.cs
/// <summary>
/// Writes row as JSON either as an array or map depending on JSONWritingOptions.RowsAsMap setting.
/// Do not call this method directly, instead call rowset.ToJSON() or use JSONWriter class
/// </summary>
Writes row as JSON either as an array or map depending on JSONWritingOptions.RowsAsMap setting.
Do not call this method directly, instead call rowset.ToJSON() or use JSONWriter class
Writes row as JSON either as an array or map depending on JSONWritingOptions . RowsAsMap setting . Do not call this method directly instead call rowset . ToJSON () or use JSONWriter class
public void WriteAsJSON(System.IO.TextWriter wri, int nestingLevel, JSONWritingOptions options = null)
            {
                if (options==null || !options.RowsAsMap)
                {
                  JSONWriter.WriteArray(wri, this, nestingLevel, options);
                  return;
                }
                var map = new Dictionary<string, object>();
                foreach(var fd in Schema)
                {
                  string name;
                  var val = FilterJSONSerializerField(fd, options, out name);
                  if (name.IsNullOrWhiteSpace()) continue;
                  map[name] = val;
                }
                if (this is IAmorphousData)
                {
                  var amorph = (IAmorphousData)this;
                  if (amorph.AmorphousDataEnabled)
                    foreach(var kv in amorph.AmorphousData)
                    {
                      var key = kv.Key;
                      while(map.ContainsKey(key)) key+="_";
                      map.Add(key, kv.Value);
                    }
                }
                JSONWriter.WriteMap(wri, map, nestingLevel, options);
            }
public void WriteAsJSON ( System . IO . TextWriter wri , int nestingLevel , JSONWritingOptions options = null ) { if ( options == null || ! options . RowsAsMap ) { JSONWriter . WriteArray ( wri , this , nestingLevel , options ) ; return ; } var map = new Dictionary < string , object > ( ) ; foreach ( var fd in Schema ) { string name ; var val = FilterJSONSerializerField ( fd , options , out name ) ; if ( name . IsNullOrWhiteSpace ( ) ) continue ; map [ name ] = val ; } if ( this is IAmorphousData ) { var amorph = ( IAmorphousData ) this ; if ( amorph . AmorphousDataEnabled ) foreach ( var kv in amorph . AmorphousData ) { var key = kv . Key ; while ( map . ContainsKey ( key ) ) key += " " ; map . Add ( key , kv . Value ) ; } } JSONWriter . WriteMap ( wri , map , nestingLevel , options ) ; }
Writes row as JSON either as an array or map depending on JSONWritingOptions.RowsAsMap setting.
Writes row as JSON either as an array or map depending on JSONWritingOptions . RowsAsMap setting .
wri
System.IO.TextWriter
nestingLevel
int
options
JSONWritingOptions