Example #1
0
        /// <exception cref="VPackParserException"/>
        public virtual VPackSlice Serialize(object entity, Type type, IDictionary <string, object> additionalFields)
        {
            if (type == typeof(VPackSlice))
            {
                return((VPackSlice)entity);
            }

            VPackBuilder builder = new VPackBuilder(this.builderOptions);

            this.Serialize(null, entity, type, builder, new Dictionary <string, object>(additionalFields));
            return(builder.Slice());
        }
Example #2
0
        /// <exception cref="VPackException"/>
        public virtual VPackSlice FromJson(string json, bool includeNullValues)
        {
            VPackBuilder builder = new VPackBuilder();

            try
            {
                new VPackJsonRParser(builder, includeNullValues).Parse(json);
            }
            catch (JsonReaderException e)
            {
                throw new VPackBuilderException(e);
            }

            return(builder.Slice());
        }