Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,11 @@ namespace Aws
JsonValue& WithNull(const Aws::String& key);
JsonValue& WithNull(const char* key);

/**
* Converts the current JSON node to null.
*/
JsonValue& AsNull();

/**
* Converts the current JSON node to a string.
*/
Expand Down
7 changes: 7 additions & 0 deletions src/aws-cpp-sdk-core/source/utils/json/JsonSerializer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,13 @@ JsonValue& JsonValue::WithNull(const Aws::String& key)
return WithNull(key.c_str());
}

JsonValue& JsonValue::AsNull()
{
Destroy();
m_value = cJSON_AS4CPP_CreateNull();
return *this;
}

JsonValue& JsonValue::AsString(const Aws::String& value)
{
Destroy();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
#if($template.currentShape.sparse)
#set($key = "${template.lowerCaseVarName}Item.first")
#set($value = "*${template.lowerCaseVarName}Item.second${CppViewHelper.computeJsonizeString($template.currentShape.mapValue.shape)}")
#if($template.currentShape.mapValue.shape.isStructure() || $template.currentShape.mapValue.shape.isTimeStamp() || $template.currentShape.mapValue.shape.isDocument())
#set($value = "${template.lowerCaseVarName}Item.second${CppViewHelper.computeJsonizeString($template.currentShape.mapValue.shape, true)}")
#end
#if($template.currentShape.mapValue.shape.isBlob())
#set($value = "HashingUtils::Base64Encode(*${template.lowerCaseVarName}Item.second${CppViewHelper.computeJsonizeString($template.currentShape.mapValue.shape)})")
#end
Expand Down Expand Up @@ -107,7 +110,11 @@
#end
#else
#if($template.currentShape.sparse)
#if($template.currentShape.listMember.shape.isStructure() || $template.currentShape.listMember.shape.isTimeStamp() || $template.currentShape.listMember.shape.isDocument())
${template.currentSpaces} ${template.lowerCaseVarName}JsonList[${template.lowerCaseVarName}Index].As${CppViewHelper.computeJsonCppType($template.currentShape.listMember.shape)}(${template.containerVar}[${template.lowerCaseVarName}Index]${CppViewHelper.computeJsonizeString($template.currentShape.listMember.shape, true)});
#else
${template.currentSpaces} ${template.lowerCaseVarName}JsonList[${template.lowerCaseVarName}Index].As${CppViewHelper.computeJsonCppType($template.currentShape.listMember.shape)}(*${template.containerVar}[${template.lowerCaseVarName}Index]${CppViewHelper.computeJsonizeString($template.currentShape.listMember.shape)});
#end
#else
${template.currentSpaces} ${template.lowerCaseVarName}JsonList[${template.lowerCaseVarName}Index].As${CppViewHelper.computeJsonCppType($template.currentShape.listMember.shape)}(${template.containerVar}[${template.lowerCaseVarName}Index]${CppViewHelper.computeJsonizeString($template.currentShape.listMember.shape)});
#end
Expand Down
Loading