diff --git a/lib/base/json.cpp b/lib/base/json.cpp index ff9f04c49..c074aed56 100644 --- a/lib/base/json.cpp +++ b/lib/base/json.cpp @@ -81,12 +81,24 @@ static void Encode(yajl_gen handle, const Value& value) break; case ValueObject: - if (value.IsObjectType()) - EncodeDictionary(handle, value); - else if (value.IsObjectType()) - EncodeArray(handle, value); - else - yajl_gen_null(handle); + { + const Object::Ptr& obj = value.Get(); + Dictionary::Ptr dict = dynamic_pointer_cast(obj); + + if (dict) { + EncodeDictionary(handle, dict); + break; + } + + Array::Ptr arr = dynamic_pointer_cast(obj); + + if (arr) { + EncodeArray(handle, arr); + break; + } + } + + yajl_gen_null(handle); break; case ValueEmpty: