added DataField::getCount(), exclude name wrap when fieldIndex is used in SingleDataField::read(), corrected json indent

This commit is contained in:
john30
2017-07-02 10:09:47 +02:00
parent 11832ca126
commit b8a4e5e032
5 changed files with 40 additions and 18 deletions
+8 -4
View File
@@ -532,16 +532,20 @@ result_t SingleDataField::read(const SymbolString& data, size_t offset,
if (leadingSeparator) {
*output << ",";
}
if (!shortFormat) {
*output << "\n ";
if (fieldIndex < 0 && !shortFormat) {
*output << "\n ";
}
if (outputIndex >= 0 || m_name.empty() || !(outputFormat & OF_NAMES)) {
*output << "\"" << static_cast<signed int>(outputIndex < 0 ? 0 : outputIndex) << "\":";
if (fieldIndex < 0) {
*output << "\"" << static_cast<signed int>(outputIndex < 0 ? 0 : outputIndex) << "\":";
}
if (!shortFormat) {
*output << " {\"name\": \"" << m_name << "\"" << ", \"value\": ";
}
} else {
*output << "\"" << m_name << "\":";
if (fieldIndex < 0) {
*output << "\"" << m_name << "\":";
}
if (!shortFormat) {
*output << " {\"value\": ";
}