82 if (keyword.size() == 1) {
83 jsonKeyword[
"Value"] = keyword[0].toStdString();
85 else if (keyword.size() > 1) {
87 for (
int i = 0; i < keyword.size(); i++) {
88 valueList.push_back(keyword[i].toStdString());
90 jsonKeyword[
"Value"] = valueList;
94 if (keyword.size() == 1 && !keyword.unit(0).isEmpty()) {
95 jsonKeyword[
"Units"] = keyword.unit(0).toStdString();
97 else if (keyword.size() > 1 && !keyword.unit(0).isEmpty()) {
99 for (
int i = 0; i < keyword.size(); i++) {
100 valueList.push_back(keyword.unit(i).toStdString());
102 jsonKeyword[
"Units"] = valueList;
106 if (keyword.comments() == 1) {
107 jsonKeyword[
"Comment"] = keyword.comment(0).toStdString();
109 else if (keyword.comments() > 1) {
111 for (
int i = 0; i < keyword.comments(); i++) {
112 commentList.push_back(keyword.comment(i).toStdString());
114 jsonKeyword[
"Comment"] = commentList;
137 PvlContainer::PvlKeywordIterator keywordIt;
138 for (keywordIt = container.begin(); keywordIt != container.end(); keywordIt++) {
139 string keywordName = keywordIt->name().replace(
"^",
"ptr").replace(
":",
"_").toStdString();
141 if ( jsonContainer.contains(keywordName) ) {
142 if (!jsonContainer[keywordName].is_array()) {
144 repeatedArray.push_back(jsonContainer[keywordName]);
145 jsonContainer[keywordName] = repeatedArray;
155 if (container.comments() == 1) {
156 jsonContainer[
"Comment"] = container.comment(0).toStdString();
158 else if (container.comments() > 1) {
160 for (
int i = 0; i < container.comments(); i++) {
161 commentList.push_back(container.comment(i).toStdString());
163 jsonContainer[
"Comment"] = commentList;
165 return jsonContainer;
301 PvlObject::PvlGroupIterator groupIt;
302 for (groupIt =
object.beginGroup(); groupIt !=
object.endGroup(); groupIt++) {
304 if ( jsonObject.contains(groupIt->name().toStdString()) ) {
305 if (!jsonObject[groupIt->name().toStdString()].is_array()) {
307 repeatedArray.push_back(jsonObject[groupIt->name().toStdString()]);
308 jsonObject[groupIt->name().toStdString()] = repeatedArray;
310 jsonObject[groupIt->name().toStdString()].push_back(
pvlGroupToJSON(*groupIt));
313 jsonObject[groupIt->name().toStdString()] =
pvlGroupToJSON(*groupIt);
318 PvlObject::PvlObjectIterator objectIt;
319 for (objectIt =
object.beginObject(); objectIt !=
object.endObject(); objectIt++) {
321 if ( jsonObject.contains(objectIt->name().toStdString()) ) {
322 if (!jsonObject[objectIt->name().toStdString()].is_array()) {
324 repeatedArray.push_back(jsonObject[objectIt->name().toStdString()]);
325 jsonObject[objectIt->name().toStdString()] = repeatedArray;
327 jsonObject[objectIt->name().toStdString()].push_back(
pvlObjectToJSON(*objectIt));
330 jsonObject[objectIt->name().toStdString()] =
pvlObjectToJSON(*objectIt);