GH# 267: JSON 'find' not returning empty result if object is expected but another value is found
GH# 267: JSON 'find' not returning empty result if object is expected but another value is found
This commit is contained in:
Родитель
106d011db0
Коммит
154c6969c2
|
@ -105,7 +105,8 @@ Release 1.5.2 (2013-09-16)
|
|||
- fixed GH# 254: UTF8::icompare unexpected behavior
|
||||
- Poco::UUID::tryParse() also accepts UUIDs without hyphens. Also updated documentation
|
||||
(links to specifications).
|
||||
|
||||
- added GH# 268: Method to get JSON object value using Poco::Nullable
|
||||
- fixed GH# 267: JSON 'find' not returning empty result if object is expected but another value is found
|
||||
|
||||
Release 1.5.1 (2013-01-11)
|
||||
==========================
|
||||
|
|
|
@ -162,6 +162,9 @@ Var Query::find(const std::string& path) const
|
|||
Object o = result.extract<Object>();
|
||||
result = o.get(name);
|
||||
}
|
||||
else
|
||||
result.empty();
|
||||
|
||||
}
|
||||
|
||||
if (!result.isEmpty() && !indexes.empty())
|
||||
|
|
|
@ -1076,6 +1076,9 @@ void JSONTest::testQuery()
|
|||
Object& rAddress = query.findObject("address", address);
|
||||
assert (rAddress.getValue<int>("number") == 123);
|
||||
|
||||
Var badAddr = query.find("address.street.anotherObject");
|
||||
assert(badAddr.isEmpty());
|
||||
|
||||
using Poco::JSON::Array;
|
||||
|
||||
Array::Ptr pChildren = query.findArray("children");
|
||||
|
@ -1212,6 +1215,13 @@ void JSONTest::testPrintHandler()
|
|||
|
||||
void JSONTest::testStringify()
|
||||
{
|
||||
Poco::JSON::Object obj;
|
||||
obj.set("one","two");
|
||||
obj.stringify(std::cout,4); //this works
|
||||
obj.stringify(std::cout,1); //this never returns
|
||||
std::cout << std::endl;
|
||||
|
||||
|
||||
std::string json = "{ \"Simpsons\" : { \"husband\" : { \"name\" : \"Homer\" , \"age\" : 38 }, \"wife\" : { \"name\" : \"Marge\", \"age\" : 36 }, "
|
||||
"\"children\" : [ \"Bart\", \"Lisa\", \"Maggie\" ], "
|
||||
"\"address\" : { \"number\" : 742, \"street\" : \"Evergreen Terrace\", \"town\" : \"Springfield\" } } }";
|
||||
|
|
Загрузка…
Ссылка в новой задаче