Newtonsoft.Json.JsonWriter.WriteRawValue C# (CSharp) Method

WriteRawValue() public method

Writes raw JSON where a value is expected and updates the writer's state.
public WriteRawValue ( string json ) : void
json string The raw JSON to write.
return void
        public virtual void WriteRawValue(string json)
        {
            // hack. want writer to change state as if a value had been written
            UpdateScopeWithFinishedValue();
            AutoComplete(JsonToken.Undefined);
            WriteRaw(json);
        }

Usage Example

        public override void WriteJson(Newtonsoft.Json.JsonWriter writer, object value, JsonSerializer serializer)
        {
            if (value is string)
            {
                if (Value_RE.Match(value.ToString()).Success)
                {
                    writer.WriteRawValue(value.ToString());
                }
                else
                {
                    string prms;

                    switch (this.Name)
                    {
                    case "before":
                        prms = "el,type,action,extraParams,o";
                        break;

                    case "complete":
                        prms = "success,response,result,el,type,action,extraParams,o";
                        break;

                    default:
                        prms = "response,result,el,type,action,extraParams,o";
                        break;
                    }

                    value = TokenUtils.ReplaceRawToken(TokenUtils.ParseTokens(value.ToString(), this.OwnerControl));
                    writer.WriteRawValue(new JFunction((string)value, prms).ToScript());
                }
            }
        }
All Usage Examples Of Newtonsoft.Json.JsonWriter::WriteRawValue