]> www.infradead.org Git - users/sagi/nvme-cli.git/commitdiff
nvme-print-json: Delete static const char string global variables
authorTokunori Ikegami <ikegami.t@gmail.com>
Thu, 2 Nov 2023 17:19:04 +0000 (02:19 +0900)
committerDaniel Wagner <wagi@monom.org>
Thu, 16 Nov 2023 10:05:54 +0000 (11:05 +0100)
Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
nvme-print-json.c

index 3646b4d18149bcbb091ceb899c6911831cdd288f..e4daae1e03b4acf972e70cf80cf1c3841535624e 100644 (file)
 static const uint8_t zero_uuid[16] = { 0 };
 static struct print_ops json_print_ops;
 
-static const char *address_str = "Address";
-static const char *controller_str = "Controller";
-static const char *count_str = "Count";
-static const char *data_str = "Data";
-static const char *device_str = "Device";
-static const char *disabled_str = "Disabled";
-static const char *element_str = "Element";
-static const char *enabled_str = "Enabled";
-static const char *endry_str = "Entry";
-static const char *enforced_str = "Enforced";
-static const char *error_str = "Error";
-static const char *false_str = "False";
-static const char *feature_str = "Feature";
-static const char *firmware_str = "Firmware";
-static const char *generic_str = "Generic";
-static const char *host_id_str = "Host ID";
-static const char *invalid_str = "Invalid";
-static const char *length_str = "Length";
-static const char *may_str = "May";
-static const char *model_number_str = "Model number";
-static const char *name_str = "Name";
-static const char *namespace_str = "Namespace";
-static const char *no_str = "No";
-static const char *not_enabled_str = "Not enabled";
-static const char *not_enforced_str = "Not enforced";
-static const char *not_ready_str = "Not ready";
-static const char *not_supported_str = "Not supported";
-static const char *not_valid_str = "Not valid";
-static const char *nsid_str = "NSID";
-static const char *operation_str = "Operation";
-static const char *path_str = "Path";
-static const char *port_id_str = "Port ID";
-static const char *ready_str = "Ready";
-static const char *reserved_str = "Reserved";
-static const char *result_str = "Result";
-static const char *revision_str = "Revision";
-static const char *serial_number_str = "Serial number";
-static const char *shall_str = "Shall";
-static const char *slot_str = "Slot";
-static const char *state_str = "State";
-static const char *status_str = "Status";
-static const char *subsystem_str = "Subsystem";
-static const char *supported_str = "Supported";
-static const char *temperature_str = "Temperature";
-static const char *threshold_str = "Threshold";
-static const char *transport_str = "Transport";
-static const char *true_str = "True";
-static const char *type_str = "Type";
-static const char *unknow_str = "Unknown";
-static const char *value_str = "Value";
-static const char *version_str = "Version";
-static const char *yes_str = "Yes";
-
 static void obj_add_uint_x(struct json_object *o, const char *k, __u32 v)
 {
        char str[STR_LEN];
@@ -171,9 +118,9 @@ static void obj_add_result(struct json_object *o, const char *v, ...)
                value = NULL;
 
        if (value)
-               obj_add_str(o, result_str, value);
+               obj_add_str(o, "Result", value);
        else
-               obj_add_str(o, result_str, "Could not allocate string");
+               obj_add_str(o, "Result", "Could not allocate string");
 
        free(value);
 }
@@ -483,7 +430,7 @@ static void json_error_log(struct nvme_error_log_page *err_log, int entries,
                obj_add_int(error, "parm_error_location",
                            le16_to_cpu(err_log[i].parm_error_location));
                obj_add_uint64(error, "lba", le64_to_cpu(err_log[i].lba));
-               obj_add_uint(error, nsid_str, le32_to_cpu(err_log[i].nsid));
+               obj_add_uint(error, "NSID", le32_to_cpu(err_log[i].nsid));
                obj_add_int(error, "vs", err_log[i].vs);
                obj_add_int(error, "trtype", err_log[i].trtype);
                obj_add_uint64(error, "cs", le64_to_cpu(err_log[i].cs));
@@ -524,7 +471,7 @@ void json_nvme_resv_report(struct nvme_resv_status *status,
 
                        obj_add_int(rc, "cntlid", le16_to_cpu(status->regctl_ds[i].cntlid));
                        obj_add_int(rc, "rcsts", status->regctl_ds[i].rcsts);
-                       obj_add_uint64(rc, host_id_str, le64_to_cpu(status->regctl_ds[i].hostid));
+                       obj_add_uint64(rc, "Host ID", le64_to_cpu(status->regctl_ds[i].hostid));
                        obj_add_uint64(rc, "rkey", le64_to_cpu(status->regctl_ds[i].rkey));
 
                        array_add_obj(rcs, rc);
@@ -550,7 +497,7 @@ void json_nvme_resv_report(struct nvme_resv_status *status,
                        for (j = 0; j < 16; j++)
                                sprintf(hostid + j * 2, "%02x", status->regctl_eds[i].hostid[j]);
 
-                       obj_add_str(rc, host_id_str, hostid);
+                       obj_add_str(rc, "Host ID", hostid);
                        array_add_obj(rcs, rc);
                }
        }
@@ -676,7 +623,7 @@ static void json_smart_log(struct nvme_smart_log *smart, unsigned int nsid,
        if (human) {
                struct json_object *crt = json_create_object();
 
-               obj_add_int(crt, value_str, smart->critical_warning);
+               obj_add_int(crt, "Value", smart->critical_warning);
                obj_add_int(crt, "available_spare", smart->critical_warning & 1);
                obj_add_int(crt, "temp_threshold", (smart->critical_warning & 2) >> 1);
                obj_add_int(crt, "reliability_degraded", (smart->critical_warning & 4) >> 2);
@@ -689,7 +636,7 @@ static void json_smart_log(struct nvme_smart_log *smart, unsigned int nsid,
                root_add_int("critical_warning", smart->critical_warning);
        }
 
-       root_add_int(temperature_str, temperature);
+       root_add_int("Temperature", temperature);
        root_add_int("avail_spare", smart->avail_spare);
        root_add_int("spare_thresh", smart->spare_thresh);
        root_add_int("percent_used", smart->percent_used);
@@ -755,12 +702,12 @@ static void json_ana_log(struct nvme_ana_log *ana_log, const char *devname,
                obj_add_uint(desc, "grpid", le32_to_cpu(ana_desc->grpid));
                obj_add_uint(desc, "nnsids", le32_to_cpu(ana_desc->nnsids));
                obj_add_uint64(desc, "chgcnt", le64_to_cpu(ana_desc->chgcnt));
-               obj_add_str(desc, state_str, nvme_ana_state_to_string(ana_desc->state));
+               obj_add_str(desc, "State", nvme_ana_state_to_string(ana_desc->state));
 
                ns_list = json_create_array();
                for (j = 0; j < le32_to_cpu(ana_desc->nnsids); j++) {
                        nsid = json_create_object();
-                       obj_add_uint(nsid, nsid_str, le32_to_cpu(ana_desc->nsids[j]));
+                       obj_add_uint(nsid, "NSID", le32_to_cpu(ana_desc->nsids[j]));
                        array_add_obj(ns_list, nsid);
                }
                obj_add_array(desc, "NSIDS", ns_list);
@@ -785,7 +732,7 @@ static void json_select_result(__u32 result)
        if (result & 0x4)
                array_add_str(feature, "changeable");
 
-       root_add_array(feature_str, feature);
+       root_add_array("Feature", feature);
 
        json_print(root);
 }
@@ -856,15 +803,15 @@ static void json_registers_cap(struct nvme_bar_cap *cap, struct json_object *roo
        root_add_str("cap", json_str);
 
        root_add_str("Controller Ready With Media Support (CRWMS)",
-                    cap->crwms ? supported_str : not_supported_str);
+                    cap->crwms ? "Supported" : "Not supported");
        root_add_str("Controller Ready Independent of Media Support (CRIMS)",
-                    cap->crims ? supported_str : not_supported_str);
+                    cap->crims ? "Supported" : "Not supported");
        root_add_str("NVM Subsystem Shutdown Supported (NSSS)",
-                    cap->nsss ? supported_str : not_supported_str);
+                    cap->nsss ? "Supported" : "Not supported");
        root_add_str("Controller Memory Buffer Supported (CMBS):",
-                    cap->cmbs ? supported_str : not_supported_str);
+                    cap->cmbs ? "Supported" : "Not supported");
        root_add_str("Persistent Memory Region Supported (PMRS)",
-                    cap->pmrs ? supported_str : not_supported_str);
+                    cap->pmrs ? "Supported" : "Not supported");
 
        sprintf(json_str, "%u bytes", 1 << (12 + cap->mpsmax));
        root_add_str("Memory Page Size Maximum (MPSMAX)", json_str);
@@ -874,17 +821,17 @@ static void json_registers_cap(struct nvme_bar_cap *cap, struct json_object *roo
 
        root_add_str("Controller Power Scope (CPS)", !cap->cps ? "Not Reported" : cap->cps == 1 ?
                     "Controller scope" : cap->cps == 2 ? "Domain scope" : "NVM subsystem scope");
-       root_add_str("Boot Partition Support (BPS)", cap->bps ? yes_str : no_str);
+       root_add_str("Boot Partition Support (BPS)", cap->bps ? "Yes" : "No");
 
        root_add_array("Command Sets Supported (CSS)", cssa);
-       obj_add_str(csso, "NVM command set", cap->css & 1 ? supported_str : not_supported_str);
+       obj_add_str(csso, "NVM command set", cap->css & 1 ? "Supported" : "Not supported");
        obj_add_str(csso, "One or more I/O Command Sets",
-                   cap->css & 0x40 ? supported_str : not_supported_str);
+                   cap->css & 0x40 ? "Supported" : "Not supported");
        obj_add_str(csso, cap->css & 0x80 ? "Only Admin Command Set" : "I/O Command Set",
-                   supported_str);
+                   "Supported");
        array_add_obj(cssa, csso);
 
-       root_add_str("NVM Subsystem Reset Supported (NSSRS)", cap->nssrs ? yes_str : no_str);
+       root_add_str("NVM Subsystem Reset Supported (NSSRS)", cap->nssrs ? "Yes" : "No");
 
        sprintf(json_str, "%u bytes", 1 << (2 + cap->dstrd));
        root_add_str("Doorbell Stride (DSTRD)", json_str);
@@ -894,10 +841,10 @@ static void json_registers_cap(struct nvme_bar_cap *cap, struct json_object *roo
 
        root_add_array("Arbitration Mechanism Supported (AMS)", amsa);
        obj_add_str(amso, "Weighted Round Robin with Urgent Priority Class",
-                   cap->ams & 2 ? supported_str : not_supported_str);
+                   cap->ams & 2 ? "Supported" : "Not supported");
        array_add_obj(amsa, amso);
 
-       root_add_str("Contiguous Queues Required (CQR)", cap->cqr ? yes_str : no_str);
+       root_add_str("Contiguous Queues Required (CQR)", cap->cqr ? "Yes" : "No");
        root_add_uint("Maximum Queue Entries Supported (MQES)", cap->mqes + 1);
 }
 
@@ -906,7 +853,7 @@ static void json_registers_version(__u32 vs, struct json_object *root)
        char json_str[STR_LEN];
 
        sprintf(json_str, "%x", vs);
-       root_add_str(version_str, json_str);
+       root_add_str("Version", json_str);
 
        sprintf(json_str, "%d.%d", (vs & 0xffff0000) >> 16, (vs & 0x0000ff00) >> 8);
        root_add_str("NVMe specification", json_str);
@@ -941,7 +888,7 @@ static void json_registers_cc_ams(__u8 ams, struct json_object *root)
                sprintf(json_str, "Vendor Specific");
                break;
        default:
-               sprintf(json_str, "%s", reserved_str);
+               sprintf(json_str, "%s", "Reserved");
                break;
        }
 
@@ -963,7 +910,7 @@ static void json_registers_cc_shn(__u8 shn, struct json_object *root)
                sprintf(json_str, "Abrupt shutdown notification");
                break;
        default:
-               sprintf(json_str, "%s", reserved_str);
+               sprintf(json_str, "%s", "Reserved");
                break;
        }
 
@@ -978,7 +925,7 @@ static void json_registers_cc(__u32 cc, struct json_object *root)
        root_add_str("cc", json_str);
 
        root_add_str("Controller Ready Independent of Media Enable (CRIME)",
-                    NVME_CC_CRIME(cc) ? enabled_str : disabled_str);
+                    NVME_CC_CRIME(cc) ? "Enabled" : "Disabled");
 
        sprintf(json_str, "%u bytes", POWER_OF_TWO(NVME_GET(cc, CC_IOCQES)));
        root_add_str("I/O Completion Queue Entry Size (IOCQES): ", json_str);
@@ -993,9 +940,9 @@ static void json_registers_cc(__u32 cc, struct json_object *root)
        root_add_str("Memory Page Size (MPS)", json_str);
 
        root_add_str("I/O Command Set Selected (CSS)", (cc & 0x70) == 0x00 ? "NVM Command Set" :
-                    (cc & 0x70) == 0x60 ? "All supported_str I/O Command Sets" :
-                    (cc & 0x70) == 0x70 ? "Admin Command Set only" : reserved_str);
-       root_add_str("Enable (EN)", cc & 1 ? yes_str : no_str);
+                    (cc & 0x70) == 0x60 ? "All supported I/O Command Sets" :
+                    (cc & 0x70) == 0x70 ? "Admin Command Set only" : "Reserved");
+       root_add_str("Enable (EN)", cc & 1 ? "Yes" : "No");
 }
 
 static void json_registers_csts_shst(__u8 shst, struct json_object *root)
@@ -1013,7 +960,7 @@ static void json_registers_csts_shst(__u8 shst, struct json_object *root)
                sprintf(json_str, "Shutdown processing complete");
                break;
        default:
-               sprintf(json_str, "%s", reserved_str);
+               sprintf(json_str, "%s", "Reserved");
                break;
        }
 
@@ -1024,13 +971,13 @@ static void json_registers_csts(__u32 csts, struct json_object *root)
 {
        root_add_uint_x("csts", csts);
 
-       root_add_str("Processing Paused (PP)", csts & 0x20 ? yes_str : no_str);
-       root_add_str("NVM Subsystem Reset Occurred (NSSRO)", csts & 0x10 ? yes_str : no_str);
+       root_add_str("Processing Paused (PP)", csts & 0x20 ? "Yes" : "No");
+       root_add_str("NVM Subsystem Reset Occurred (NSSRO)", csts & 0x10 ? "Yes" : "No");
 
        json_registers_csts_shst((csts & 0xc) >> 2, root);
 
-       root_add_str("Controller Fatal Status (CFS)", csts & 2 ? true_str : false_str);
-       root_add_str("Ready (RDY)", csts & 1 ? yes_str : no_str);
+       root_add_str("Controller Fatal Status (CFS)", csts & 2 ? "True" : "False");
+       root_add_str("Ready (RDY)", csts & 1 ? "Yes" : "No");
 }
 
 static void json_registers_nssr(__u32 nssr, struct json_object *root)
@@ -1081,15 +1028,15 @@ static void json_registers_cmbloc(uint32_t cmbloc, void *bar, struct json_object
                         (cmbloc & 0xfffff000) >> 12);
        root_add_int("CMB Queue Dword Alignment (CQDA)", (cmbloc & 0x100) >> 8);
        root_add_str("CMB Data Metadata Mixed Memory Support (CDMMMS)",
-                    (cmbloc & 0x00000080) >> 7 ? not_enforced_str : enforced_str);
+                    (cmbloc & 0x00000080) >> 7 ? "Not enforced" : "Enforced");
        root_add_str("CMB Data Pointer and Command Independent Locations Support (CDPCILS)",
-                    (cmbloc & 0x00000040) >> 6 ? not_enforced_str : enforced_str);
+                    (cmbloc & 0x00000040) >> 6 ? "Not enforced" : "Enforced");
        root_add_str("CMB Data Pointer Mixed Locations Support (CDPMLS)",
-                    (cmbloc & 0x00000020) >> 5 ? not_enforced_str : enforced_str);
+                    (cmbloc & 0x00000020) >> 5 ? "Not enforced" : "Enforced");
        root_add_str("CMB Queue Physically Discontiguous Support (CQPDS)",
-                    (cmbloc & 0x00000010) >> 4 ? not_enforced_str : enforced_str);
+                    (cmbloc & 0x00000010) >> 4 ? "Not enforced" : "Enforced");
        root_add_str("CMB Queue Mixed Memory Support (CQMMS)",
-                    (cmbloc & 0x00000008) >> 3 ? not_enforced_str : enforced_str);
+                    (cmbloc & 0x00000008) >> 3 ? "Not enforced" : "Enforced");
        root_add_uint_0x("Base Indicator Register (BIR)", (cmbloc & 0x00000007));
 }
 
@@ -1104,11 +1051,11 @@ static void json_registers_cmbsz(uint32_t cmbsz, struct json_object *root)
 
        root_add_uint("Size (SZ)", (cmbsz & 0xfffff000) >> 12);
        root_add_str("Size Units (SZU)", nvme_register_szu_to_string((cmbsz & 0xf00) >> 8));
-       root_add_str("Write Data Support (WDS)", cmbsz & 0x10 ? supported_str : not_supported_str);
-       root_add_str("Read Data Support (RDS)", cmbsz & 8 ? supported_str : not_supported_str);
-       root_add_str("PRP SGL List Support (LISTS)", cmbsz & 4 ? supported_str : not_supported_str);
-       root_add_str("Completion Queue Support (CQS)", cmbsz & 2 ? supported_str : not_supported_str);
-       root_add_str("Submission Queue Support (SQS)", cmbsz & 1 ? supported_str : not_supported_str);
+       root_add_str("Write Data Support (WDS)", cmbsz & 0x10 ? "Supported" : "Not supported");
+       root_add_str("Read Data Support (RDS)", cmbsz & 8 ? "Supported" : "Not supported");
+       root_add_str("PRP SGL List Support (LISTS)", cmbsz & 4 ? "Supported" : "Not supported");
+       root_add_str("Completion Queue Support (CQS)", cmbsz & 2 ? "Supported" : "Not supported");
+       root_add_str("Submission Queue Support (SQS)", cmbsz & 1 ? "Supported" : "Not supported");
 }
 
 static void json_registers_bpinfo_brs(__u8 brs, struct json_object *root)
@@ -1129,7 +1076,7 @@ static void json_registers_bpinfo_brs(__u8 brs, struct json_object *root)
                sprintf(json_str, "Error completing Boot Partition read");
                break;
        default:
-               sprintf(json_str, "%s", invalid_str);
+               sprintf(json_str, "%s", "Invalid");
                break;
        }
 
@@ -1168,7 +1115,7 @@ static void json_registers_cmbmsc(uint64_t cmbmsc, struct json_object *root)
        root_add_prix64("Controller Base Address (CBA)", (cmbmsc & 0xfffffffffffff000) >> 12);
        root_add_prix64("Controller Memory Space Enable (CMSE)", (cmbmsc & 2) >> 1);
        root_add_str("Capabilities Registers Enabled (CRE)",
-                    cmbmsc & 1 ? enabled_str : not_enabled_str);
+                    cmbmsc & 1 ? "Enabled" : "Not enabled");
 }
 
 static void json_registers_cmbsts(uint32_t cmbsts , struct json_object *root)
@@ -1183,22 +1130,22 @@ static void json_registers_pmrcap(uint32_t pmrcap, struct json_object *root)
        root_add_uint_x("pmrcap", pmrcap);
 
        root_add_str("Controller Memory Space Supported (CMSS)",
-              ((pmrcap & 0x01000000) >> 24) ? supported_str : not_supported_str);
+              ((pmrcap & 0x01000000) >> 24) ? "Supported" : "Not supported");
        root_add_uint_x("Persistent Memory Region Timeout (PMRTO)", (pmrcap & 0xff0000) >> 16);
        root_add_uint_x("Persistent Memory Region Write Barrier Mechanisms (PMRWBM)",
                        (pmrcap & 0x3c00) >> 10);
        root_add_str("Persistent Memory Region Time Units (PMRTU)",
                     (pmrcap & 0x300) >> 8 ? "minutes" : "500 milliseconds");
        root_add_uint_x("Base Indicator Register (BIR)", (pmrcap & 0xe0) >> 5);
-       root_add_str("Write Data Support (WDS)", pmrcap & 0x10 ? supported_str : not_supported_str);
-       root_add_str("Read Data Support (RDS)", pmrcap & 8 ? supported_str : not_supported_str);
+       root_add_str("Write Data Support (WDS)", pmrcap & 0x10 ? "Supported" : "Not supported");
+       root_add_str("Read Data Support (RDS)", pmrcap & 8 ? "Supported" : "Not supported");
 }
 
 static void json_registers_pmrctl(uint32_t pmrctl, struct json_object *root)
 {
        root_add_uint_x("pmrctl", pmrctl);
 
-       root_add_str("Enable (EN)", pmrctl & 1 ? ready_str : disabled_str);
+       root_add_str("Enable (EN)", pmrctl & 1 ? "Ready" : "Disabled");
 }
 
 static void json_registers_pmrsts(uint32_t pmrsts, void *bar, struct json_object *root)
@@ -1211,7 +1158,7 @@ static void json_registers_pmrsts(uint32_t pmrsts, void *bar, struct json_object
        root_add_str("Health Status (HSTS)",
                     nvme_register_pmr_hsts_to_string((pmrsts & 0xe00) >> 9));
        root_add_str("Not Ready (NRDY)",
-                    !(pmrsts & 0x100) && (pmrctl & 1) ? ready_str : not_ready_str);
+                    !(pmrsts & 0x100) && (pmrctl & 1) ? "Ready" : "Not ready");
        root_add_uint_x("Error (ERR)", pmrsts & 0xff);
 }
 
@@ -1220,7 +1167,7 @@ static void json_registers_pmrebs(uint32_t pmrebs, struct json_object *root)
        root_add_uint_x("pmrebs", pmrebs);
 
        root_add_uint_x("PMR Elasticity Buffer Size Base (PMRWBZ)", (pmrebs & 0xffffff00) >> 8);
-       root_add_str("Read Bypass Behavior", pmrebs & 0x10 ? shall_str : may_str);
+       root_add_str("Read Bypass Behavior", pmrebs & 0x10 ? "Shall" : "May");
        root_add_str("PMR Elasticity Buffer Size Units (PMRSZU)",
                     nvme_register_pmr_pmrszu_to_string(pmrebs & 0xf));
 }
@@ -1252,8 +1199,8 @@ static void json_registers_pmrmscu(uint32_t pmrmscu, struct json_object *root)
 static void json_registers_unknown(int offset, uint64_t value64, struct json_object *root)
 {
        root_add_uint_02x("unknown property", offset);
-       root_add_str(name_str, nvme_register_to_string(offset));
-       root_add_prix64(value_str, value64);
+       root_add_str("Name", nvme_register_to_string(offset));
+       root_add_prix64("Value", value64);
 }
 
 static void json_single_property_human(int offset, uint64_t value64, struct json_object *root)
@@ -1298,14 +1245,14 @@ static void json_single_property(int offset, uint64_t value64)
                sprintf(json_str, "0x%02x", offset);
                root_add_str("property", json_str);
 
-               root_add_str(name_str, nvme_register_to_string(offset));
+               root_add_str("Name", nvme_register_to_string(offset));
 
                if (nvme_is_64bit_reg(offset))
                        sprintf(json_str, "%"PRIx64"", value64);
                else
                        sprintf(json_str, "%x", value32);
 
-               root_add_str(value_str, json_str);
+               root_add_str("Value", json_str);
        }
 
        json_print(root);
@@ -1403,7 +1350,7 @@ static void json_predictable_latency_per_nvmset(
        struct json_object *root = json_create_object();
 
        root_add_uint("nvmset_id", le16_to_cpu(nvmset_id));
-       root_add_uint(status_str, plpns_log->status);
+       root_add_uint("Status", plpns_log->status);
        root_add_uint("event_type", le16_to_cpu(plpns_log->event_type));
        root_add_uint64("dtwin_reads_typical", le64_to_cpu(plpns_log->dtwin_rt));
        root_add_uint64("dtwin_writes_typical", le64_to_cpu(plpns_log->dtwin_wt));
@@ -1431,7 +1378,7 @@ static void json_predictable_latency_event_agg_log(
 
        for (int i = 0; i < num_iter; i++) {
                valid_attrs = json_create_object();
-               obj_add_uint(valid_attrs, endry_str, le16_to_cpu(pea_log->entries[i]));
+               obj_add_uint(valid_attrs, "Entry", le16_to_cpu(pea_log->entries[i]));
                array_add_obj(valid, valid_attrs);
        }
 
@@ -1512,7 +1459,7 @@ static void json_pel_smart_health(void *pevent_log_info, __u32 offset,
        __s32 temp;
 
        obj_add_int(valid_attrs, "critical_warning", smart_event->critical_warning);
-       obj_add_int(valid_attrs, temperature_str, temperature);
+       obj_add_int(valid_attrs, "Temperature", temperature);
        obj_add_int(valid_attrs, "avail_spare", smart_event->avail_spare);
        obj_add_int(valid_attrs, "spare_thresh", smart_event->spare_thresh);
        obj_add_int(valid_attrs, "percent_used", smart_event->percent_used);
@@ -1628,7 +1575,7 @@ static void json_pel_change_ns(void *pevent_log_info, __u32 offset, struct json_
        obj_add_uint(valid_attrs, "nmic", ns_event->nmic);
        obj_add_uint(valid_attrs, "ana_grp_id", le32_to_cpu(ns_event->ana_grp_id));
        obj_add_uint(valid_attrs, "nvmset_id", le16_to_cpu(ns_event->nvmset_id));
-       obj_add_uint(valid_attrs, nsid_str, le32_to_cpu(ns_event->nsid));
+       obj_add_uint(valid_attrs, "NSID", le32_to_cpu(ns_event->nsid));
 }
 
 static void json_pel_format_start(void *pevent_log_info, __u32 offset,
@@ -1636,7 +1583,7 @@ static void json_pel_format_start(void *pevent_log_info, __u32 offset,
 {
        struct nvme_format_nvm_start_event *format_start_event = pevent_log_info + offset;
 
-       obj_add_uint(valid_attrs, nsid_str, le32_to_cpu(format_start_event->nsid));
+       obj_add_uint(valid_attrs, "NSID", le32_to_cpu(format_start_event->nsid));
        obj_add_uint(valid_attrs, "fna", format_start_event->fna);
        obj_add_uint(valid_attrs, "format_nvm_cdw10",
                     le32_to_cpu(format_start_event->format_nvm_cdw10));
@@ -1647,7 +1594,7 @@ static void json_pel_format_completion(void *pevent_log_info, __u32 offset,
 {
        struct nvme_format_nvm_compln_event *format_cmpln_event = pevent_log_info + offset;
 
-       obj_add_uint(valid_attrs, nsid_str, le32_to_cpu(format_cmpln_event->nsid));
+       obj_add_uint(valid_attrs, "NSID", le32_to_cpu(format_cmpln_event->nsid));
        obj_add_uint(valid_attrs, "smallest_fpi", format_cmpln_event->smallest_fpi);
        obj_add_uint(valid_attrs, "format_nvm_status", format_cmpln_event->format_nvm_status);
        obj_add_uint(valid_attrs, "compln_info", le16_to_cpu(format_cmpln_event->compln_info));
@@ -1679,7 +1626,7 @@ static void json_pel_thermal_excursion(void *pevent_log_info, __u32 offset,
        struct nvme_thermal_exc_event *thermal_exc_event = pevent_log_info + offset;
 
        obj_add_uint(valid_attrs, "over_temp", thermal_exc_event->over_temp);
-       obj_add_uint(valid_attrs, threshold_str, thermal_exc_event->threshold);
+       obj_add_uint(valid_attrs, "Threshold", thermal_exc_event->threshold);
 }
 
 static void json_pevent_entry(void *pevent_log_info, __u8 action, __u32 size, const char *devname,
@@ -1793,7 +1740,7 @@ static void json_endurance_group_event_agg_log(
 
        for (int i = 0; i < log_entries; i++) {
                valid_attrs = json_create_object();
-               obj_add_uint(valid_attrs, endry_str, le16_to_cpu(endurance_log->entries[i]));
+               obj_add_uint(valid_attrs, "Entry", le16_to_cpu(endurance_log->entries[i]));
                array_add_obj(valid, valid_attrs);
        }
 
@@ -1837,7 +1784,7 @@ static void json_lba_status(struct nvme_lba_status *list,
                sprintf(json_str, "0x%08x", le32_to_cpu(e->nlb));
                obj_add_str(lsde, "NLB", json_str);
                sprintf(json_str, "0x%02x", e->status);
-               obj_add_str(lsde, status_str, json_str);
+               obj_add_str(lsde, "Status", json_str);
        }
 
        json_print(root);
@@ -1904,10 +1851,10 @@ static void json_resv_notif_log(struct nvme_resv_notification_log *resv,
 {
        struct json_object *root = json_create_object();
 
-       root_add_uint64(count_str, le64_to_cpu(resv->lpc));
+       root_add_uint64("Count", le64_to_cpu(resv->lpc));
        root_add_uint("rn_log_type", resv->rnlpt);
        root_add_uint("num_logs", resv->nalp);
-       root_add_uint(nsid_str, le32_to_cpu(resv->nsid));
+       root_add_uint("NSID", le32_to_cpu(resv->nsid));
 
        json_print(root);
 }
@@ -1970,7 +1917,7 @@ static void json_boot_part_log(void *bp_log, const char *devname,
        struct nvme_boot_partition *hdr = bp_log;
        struct json_object *root = json_create_object();
 
-       root_add_uint(count_str, hdr->lid);
+       root_add_uint("Count", hdr->lid);
        root_add_uint("abpid", (le32_to_cpu(hdr->bpinfo) >> 31) & 0x1);
        root_add_uint("bpsz", le32_to_cpu(hdr->bpinfo) & 0x7fff);
 
@@ -2299,11 +2246,11 @@ static void json_nvme_fdp_events(struct nvme_fdp_events_log *log)
 
                struct json_object *obj_event = json_create_object();
 
-               obj_add_uint(obj_event, type_str, event->type);
+               obj_add_uint(obj_event, "Type", event->type);
                obj_add_uint(obj_event, "fdpef", event->flags);
                obj_add_uint(obj_event, "pid", le16_to_cpu(event->pid));
                obj_add_uint64(obj_event, "timestamp", le64_to_cpu(*(uint64_t *)&event->ts));
-               obj_add_uint(obj_event, nsid_str, le32_to_cpu(event->nsid));
+               obj_add_uint(obj_event, "NSID", le32_to_cpu(event->nsid));
 
                if (event->type == NVME_FDP_EVENT_REALLOC) {
                        struct nvme_fdp_event_realloc *mr;
@@ -2368,10 +2315,10 @@ static unsigned int json_print_nvme_subsystem_multipath(nvme_subsystem_t s, json
                nvme_ctrl_t c = nvme_path_get_ctrl(p);
 
                path_attrs = json_create_object();
-               obj_add_str(path_attrs, name_str, nvme_ctrl_get_name(c));
-               obj_add_str(path_attrs, transport_str, nvme_ctrl_get_transport(c));
-               obj_add_str(path_attrs, address_str, nvme_ctrl_get_address(c));
-               obj_add_str(path_attrs, state_str, nvme_ctrl_get_state(c));
+               obj_add_str(path_attrs, "Name", nvme_ctrl_get_name(c));
+               obj_add_str(path_attrs, "Transport", nvme_ctrl_get_transport(c));
+               obj_add_str(path_attrs, "Address", nvme_ctrl_get_address(c));
+               obj_add_str(path_attrs, "State", nvme_ctrl_get_state(c));
                obj_add_str(path_attrs, "ANAState", nvme_path_get_ana_state(p));
                array_add_obj(paths, path_attrs);
                i++;
@@ -2389,10 +2336,10 @@ static void json_print_nvme_subsystem_ctrls(nvme_subsystem_t s,
                struct json_object *path_attrs;
 
                path_attrs = json_create_object();
-               obj_add_str(path_attrs, name_str, nvme_ctrl_get_name(c));
-               obj_add_str(path_attrs, transport_str, nvme_ctrl_get_transport(c));
-               obj_add_str(path_attrs, address_str, nvme_ctrl_get_address(c));
-               obj_add_str(path_attrs, state_str, nvme_ctrl_get_state(c));
+               obj_add_str(path_attrs, "Name", nvme_ctrl_get_name(c));
+               obj_add_str(path_attrs, "Transport", nvme_ctrl_get_transport(c));
+               obj_add_str(path_attrs, "Address", nvme_ctrl_get_address(c));
+               obj_add_str(path_attrs, "State", nvme_ctrl_get_state(c));
                array_add_obj(paths, path_attrs);
        }
 }
@@ -2413,11 +2360,11 @@ static void json_print_nvme_subsystem_list(nvme_root_t r, bool show_ana)
                obj_add_str(host_attrs, "HostNQN", nvme_host_get_hostnqn(h));
                hostid = nvme_host_get_hostid(h);
                if (hostid)
-                       obj_add_str(host_attrs, host_id_str, hostid);
+                       obj_add_str(host_attrs, "Host ID", hostid);
                subsystems = json_create_array();
                nvme_for_each_subsystem(h, s) {
                        subsystem_attrs = json_create_object();
-                       obj_add_str(subsystem_attrs, name_str, nvme_subsystem_get_name(s));
+                       obj_add_str(subsystem_attrs, "Name", nvme_subsystem_get_name(s));
                        obj_add_str(subsystem_attrs, "NQN", nvme_subsystem_get_nqn(s));
                        obj_add_str(subsystem_attrs, "IOPolicy", nvme_subsystem_get_iopolicy(s));
 
@@ -2825,7 +2772,7 @@ static void json_nvme_id_ns_descs(void *data, unsigned int nsid)
                        obj_add_int(elem, "loc", pos);
                        obj_add_int(elem, "nidt", (int)cur->nidt);
                        obj_add_int(elem, "nidl", (int)cur->nidl);
-                       obj_add_str(elem, type_str, nidt_name);
+                       obj_add_str(elem, "Type", nidt_name);
                        obj_add_str(elem, nidt_name, json_str);
 
                        if (!json_array)
@@ -2942,7 +2889,7 @@ static void json_nvme_list_ns(struct nvme_ns_list *ns_list)
        for (i = 0; i < 1024; i++) {
                if (ns_list->ns[i]) {
                        valid_attrs = json_create_object();
-                       obj_add_uint(valid_attrs, nsid_str, le32_to_cpu(ns_list->ns[i]));
+                       obj_add_uint(valid_attrs, "NSID", le32_to_cpu(ns_list->ns[i]));
                        array_add_obj(valid, valid_attrs);
                }
        }
@@ -3006,8 +2953,8 @@ static void json_nvme_zns_report_zones(void *report, __u32 descs,
                obj_add_uint64(zone, "slba", le64_to_cpu(desc->zslba));
                obj_add_uint64(zone, "wp", le64_to_cpu(desc->wp));
                obj_add_uint64(zone, "cap", le64_to_cpu(desc->zcap));
-               obj_add_str(zone, state_str, nvme_zone_state_to_string(desc->zs >> 4));
-               obj_add_str(zone, type_str, nvme_zone_type_to_string(desc->zt));
+               obj_add_str(zone, "State", nvme_zone_state_to_string(desc->zs >> 4));
+               obj_add_str(zone, "Type", nvme_zone_type_to_string(desc->zt));
                obj_add_uint(zone, "attrs", desc->za);
                obj_add_uint(zone, "attrs_info", desc->zai);
 
@@ -3018,7 +2965,7 @@ static void json_nvme_zns_report_zones(void *report, __u32 descs,
                                        ext_size, 16, 1, ext_data);
                                obj_add_array(zone, "ext_data", ext_data);
                        } else {
-                               obj_add_str(zone, "ext_data", not_valid_str);
+                               obj_add_str(zone, "ext_data", "Not valid");
                        }
                }
 
@@ -3074,7 +3021,7 @@ static void json_lba_range_entry(struct nvme_lba_range_type *lbrt, int nr_ranges
 
                obj_add_int(lbare, "LBA range", i);
 
-               obj_add_uint_nx(lbare, type_str, lbrt->entry[i].type);
+               obj_add_uint_nx(lbare, "Type", lbrt->entry[i].type);
 
                obj_add_str(lbare, "type description",
                            nvme_feature_lba_type_to_string(lbrt->entry[i].type));
@@ -3140,7 +3087,7 @@ static void json_feature_show_fields_err_recovery(unsigned int result)
        char json_str[STR_LEN];
 
        root_add_str("Deallocated or Unwritten Logical Block Error Enable (DULBE)",
-                    (result & 0x10000) >> 16 ? enabled_str : disabled_str);
+                    (result & 0x10000) >> 16 ? "Enabled" : "Disabled");
 
        sprintf(json_str, "%u ms", (result & 0xffff) * 100);
        root_add_str("Time Limited Error Recovery (TLER)", json_str);
@@ -3152,7 +3099,7 @@ static void json_feature_show_fields_volatile_wc(unsigned int result)
 {
        struct json_object *root = json_create_object();
 
-       root_add_str("Volatile Write Cache Enable (WCE)", result & 1 ? enabled_str : disabled_str);
+       root_add_str("Volatile Write Cache Enable (WCE)", result & 1 ? "Enabled" : "Disabled");
 
        json_print(root);
 }
@@ -3186,7 +3133,7 @@ static void json_feature_show_fields_irq_config(unsigned int result)
 {
        struct json_object *root = json_create_object();
 
-       root_add_str("Coalescing Disable (CD)", (result & 0x10000) >> 16 ? true_str : false_str);
+       root_add_str("Coalescing Disable (CD)", (result & 0x10000) >> 16 ? "True" : "False");
 
        root_add_uint("Interrupt Vector (IV)", result & 0xffff);
 
@@ -3197,7 +3144,7 @@ static void json_feature_show_fields_write_atomic(unsigned int result)
 {
        struct json_object *root = json_create_object();
 
-       root_add_str("Disable Normal (DN)", result & 1 ? true_str : false_str);
+       root_add_str("Disable Normal (DN)", result & 1 ? "True" : "False");
 
        json_print(root);
 }
@@ -3242,7 +3189,7 @@ static void json_auto_pst(struct nvme_feat_auto_pst *apst, struct json_object *r
                apste = json_create_object();
                array_add_obj(apsta, apste);
                sprintf(json_str, "%2d", i);
-               obj_add_str(apste, endry_str, json_str);
+               obj_add_str(apste, "Entry", json_str);
                value = le64_to_cpu(apst->apst_entry[i]);
                sprintf(json_str, "%u ms", (__u32)NVME_GET(value, APST_ENTRY_ITPT));
                obj_add_str(apste, "Idle Time Prior to Transition (ITPT)", json_str);
@@ -3255,8 +3202,8 @@ static void json_feature_show_fields_auto_pst(unsigned int result, unsigned char
 {
        struct json_object *root = json_create_object();
 
-       root_add_str("Autonomous Power State Transition Enable (APSTE)", result & 1 ? enabled_str :
-                    disabled_str);
+       root_add_str("Autonomous Power State Transition Enable (APSTE)", result & 1 ? "Enabled" :
+                    "Disabled");
 
        if (buf)
                json_auto_pst((struct nvme_feat_auto_pst *)buf, root);
@@ -3283,7 +3230,7 @@ static void json_feature_show_fields_host_mem_buf(unsigned int result, unsigned
 {
        struct json_object *root = json_create_object();
 
-       root_add_str("Enable Host Memory (EHM)", result & 1 ? enabled_str : disabled_str);
+       root_add_str("Enable Host Memory (EHM)", result & 1 ? "Enabled" : "Disabled");
 
        if (buf)
                json_host_mem_buffer((struct nvme_host_mem_buf_attrs *)buf, root);
@@ -3356,7 +3303,7 @@ static void json_feature_show_fields_nopsc(unsigned int result)
        struct json_object *root = json_create_object();
 
        root_add_str("Non-Operational Power State Permissive Mode Enable (NOPPME)", result & 1 ?
-                    true_str : false_str);
+                    "True" : "False");
 
        json_print(root);
 }
@@ -3386,7 +3333,7 @@ static void json_feature_show_fields_plm_config(unsigned int result, unsigned ch
 {
        struct json_object *root = json_create_object();
 
-       root_add_str("Predictable Latency Window Enabled", result & 1 ? true_str : false_str);
+       root_add_str("Predictable Latency Window Enabled", result & 1 ? "True" : "False");
 
        if (buf)
                json_plm_config((struct nvme_plm_config *)buf, root);
@@ -3418,7 +3365,7 @@ static void json_feature_show_fields_host_behavior(unsigned char *buf)
        struct json_object *root = json_create_object();
 
        if (buf)
-               root_add_str("Host Behavior Support", buf[0] & 0x1 ? true_str : false_str);
+               root_add_str("Host Behavior Support", buf[0] & 0x1 ? "True" : "False");
 
        json_print(root);
 }
@@ -3446,7 +3393,7 @@ static void json_feature_show_fields_iocs_profile(unsigned int result)
 {
        struct json_object *root = json_create_object();
 
-       root_add_str("I/O Command Set Profile", result & 0x1 ? true_str : false_str);
+       root_add_str("I/O Command Set Profile", result & 0x1 ? "True" : "False");
 
        json_print(root);
 }
@@ -3455,7 +3402,7 @@ static void json_feature_show_fields_spinup_control(unsigned int result)
 {
        struct json_object *root = json_create_object();
 
-       root_add_str("Spinup control feature Enabled", result & 1 ? true_str : false_str);
+       root_add_str("Spinup control feature Enabled", result & 1 ? "True" : "False");
 
        json_print(root);
 }
@@ -3479,21 +3426,21 @@ static void json_host_metadata(enum nvme_features_id fid, struct nvme_host_metad
                desce = json_create_object();
                array_add_obj(desca, desce);
 
-               obj_add_int(desce, element_str, i);
+               obj_add_int(desce, "Element", i);
 
                sprintf(json_str, "0x%02x", desc->type);
-               obj_add_str(desce, type_str, json_str);
+               obj_add_str(desce, "Type", json_str);
 
                obj_add_str(desce, "Type definition",
                            nvme_host_metadata_type_to_string(fid, desc->type));
 
-               obj_add_int(desce, revision_str, desc->rev);
+               obj_add_int(desce, "Revision", desc->rev);
 
                len = le16_to_cpu(desc->len);
-               obj_add_int(desce, length_str, len);
+               obj_add_int(desce, "Length", len);
 
                strncpy(val, (char *)desc->val, min(sizeof(val) - 1, len));
-               obj_add_str(desce, value_str, val);
+               obj_add_str(desce, "Value", val);
 
                desc = (struct nvme_metadata_element_desc *)&desc->val[desc->len];
        }
@@ -3539,11 +3486,11 @@ static void json_feature_show_fields_resv_mask(unsigned int result)
        struct json_object *root = json_create_object();
 
        root_add_str("Mask Reservation Preempted Notification (RESPRE)", (result & 8) >> 3 ?
-                    true_str : false_str);
+                    "True" : "False");
        root_add_str("Mask Reservation Released Notification (RESREL)", (result & 4) >> 2 ?
-                    true_str : false_str);
+                    "True" : "False");
        root_add_str("Mask Registration Preempted Notification (REGPRE)", (result & 2) >> 1 ?
-                    true_str : false_str);
+                    "True" : "False");
 
        json_print(root);
 }
@@ -3552,7 +3499,7 @@ static void json_feature_show_fields_resv_persist(unsigned int result)
 {
        struct json_object *root = json_create_object();
 
-       root_add_str("Persist Through Power Loss (PTPL)", result & 1 ? true_str : false_str);
+       root_add_str("Persist Through Power Loss (PTPL)", result & 1 ? "True" : "False");
 
        json_print(root);
 }
@@ -3570,7 +3517,7 @@ static void json_feature_show_fields_fdp(unsigned int result)
 {
        struct json_object *root = json_create_object();
 
-       root_add_str("Flexible Direct Placement Enable (FDPE)", result & 1 ? yes_str : no_str);
+       root_add_str("Flexible Direct Placement Enable (FDPE)", result & 1 ? "Yes" : "No");
        root_add_uint("Flexible Direct Placement Configuration Index", result >> 8 & 0xf);
 
        json_print(root);
@@ -3585,7 +3532,7 @@ static void json_feature_show_fields_fdp_events(unsigned int result, unsigned ch
 
        for (i = 0; i < result; i++) {
                d = &((struct nvme_fdp_supported_event_desc *)buf)[i];
-               sprintf(json_str, "%s", d->evta & 0x1 ? enabled_str : not_enabled_str);
+               sprintf(json_str, "%s", d->evta & 0x1 ? "Enabled" : "Not enabled");
                root_add_str(nvme_fdp_event_to_string(d->evt), json_str);
        }
 
@@ -3598,9 +3545,9 @@ static void json_feature_show(enum nvme_features_id fid, int sel, unsigned int r
        char json_str[STR_LEN];
 
        sprintf(json_str, "%#0*x", fid ? 4 : 2, fid);
-       root_add_str(feature_str, json_str);
+       root_add_str("Feature", json_str);
 
-       root_add_str(name_str, nvme_feature_to_string(fid));
+       root_add_str("Name", nvme_feature_to_string(fid));
 
        sprintf(json_str, "%#0*x", result ? 10 : 8, result);
        root_add_str(nvme_select_to_string(sel), json_str);
@@ -3770,7 +3717,7 @@ void json_d(unsigned char *buf, int len, int width, int group)
        struct json_object *data = json_create_array();
 
        d_json(buf, len, width, group, data);
-       root_add_array(data_str, data);
+       root_add_array("Data", data);
 
        json_print(root);
 }
@@ -3829,7 +3776,7 @@ static void json_nvme_primary_ctrl_cap(const struct nvme_primary_ctrl_cap *caps)
        struct json_object *root = json_create_object();
 
        root_add_uint("cntlid", le16_to_cpu(caps->cntlid));
-       root_add_uint(port_id_str, le16_to_cpu(caps->portid));
+       root_add_uint("Port ID", le16_to_cpu(caps->portid));
        root_add_uint("crt", caps->crt);
 
        root_add_uint("vqfrt", le32_to_cpu(caps->vqfrt));
@@ -4022,14 +3969,14 @@ static void json_detail_list(nvme_root_t r)
                obj_add_str(hss, "HostNQN", nvme_host_get_hostnqn(h));
                hostid = nvme_host_get_hostid(h);
                if (hostid)
-                       obj_add_str(hss, host_id_str, hostid);
+                       obj_add_str(hss, "Host ID", hostid);
 
                nvme_for_each_subsystem(h , s) {
                        struct json_object *jss = json_create_object();
                        struct json_object *jctrls = json_create_array();
                        struct json_object *jnss = json_create_array();
 
-                       obj_add_str(jss, subsystem_str, nvme_subsystem_get_name(s));
+                       obj_add_str(jss, "Subsystem", nvme_subsystem_get_name(s));
                        obj_add_str(jss, "SubsystemNQN", nvme_subsystem_get_nqn(s));
 
                        nvme_subsystem_for_each_ctrl(s, c) {
@@ -4037,13 +3984,13 @@ static void json_detail_list(nvme_root_t r)
                                struct json_object *jnss = json_create_array();
                                struct json_object *jpaths = json_create_array();
 
-                               obj_add_str(jctrl, controller_str, nvme_ctrl_get_name(c));
-                               obj_add_str(jctrl, serial_number_str, nvme_ctrl_get_serial(c));
-                               obj_add_str(jctrl, model_number_str, nvme_ctrl_get_model(c));
-                               obj_add_str(jctrl, firmware_str, nvme_ctrl_get_firmware(c));
-                               obj_add_str(jctrl, transport_str, nvme_ctrl_get_transport(c));
-                               obj_add_str(jctrl, address_str, nvme_ctrl_get_address(c));
-                               obj_add_str(jctrl, slot_str, nvme_ctrl_get_phy_slot(c));
+                               obj_add_str(jctrl, "Controller", nvme_ctrl_get_name(c));
+                               obj_add_str(jctrl, "Serial number", nvme_ctrl_get_serial(c));
+                               obj_add_str(jctrl, "Model number", nvme_ctrl_get_model(c));
+                               obj_add_str(jctrl, "Firmware", nvme_ctrl_get_firmware(c));
+                               obj_add_str(jctrl, "Transport", nvme_ctrl_get_transport(c));
+                               obj_add_str(jctrl, "Address", nvme_ctrl_get_address(c));
+                               obj_add_str(jctrl, "Slot", nvme_ctrl_get_phy_slot(c));
 
                                nvme_ctrl_for_each_ns(c, n) {
                                        struct json_object *jns = json_create_object();
@@ -4051,9 +3998,9 @@ static void json_detail_list(nvme_root_t r)
                                        uint64_t nsze = nvme_ns_get_lba_count(n) * lba;
                                        uint64_t nuse = nvme_ns_get_lba_util(n) * lba;
 
-                                       obj_add_str(jns, namespace_str, nvme_ns_get_name(n));
-                                       obj_add_str(jns, generic_str, nvme_ns_get_generic_name(n));
-                                       obj_add_int(jns, nsid_str, nvme_ns_get_nsid(n));
+                                       obj_add_str(jns, "Namespace", nvme_ns_get_name(n));
+                                       obj_add_str(jns, "Generic", nvme_ns_get_generic_name(n));
+                                       obj_add_int(jns, "NSID", nvme_ns_get_nsid(n));
                                        obj_add_uint64(jns, "UsedBytes", nuse);
                                        obj_add_uint64(jns, "MaximumLBA", nvme_ns_get_lba_count(n));
                                        obj_add_uint64(jns, "PhysicalSize", nsze);
@@ -4066,7 +4013,7 @@ static void json_detail_list(nvme_root_t r)
                                nvme_ctrl_for_each_path(c, p) {
                                        struct json_object *jpath = json_create_object();
 
-                                       obj_add_str(jpath, path_str, nvme_path_get_name(p));
+                                       obj_add_str(jpath, "Path", nvme_path_get_name(p));
                                        obj_add_str(jpath, "ANAState", nvme_path_get_ana_state(p));
 
                                        array_add_obj(jpaths, jpath);
@@ -4084,9 +4031,9 @@ static void json_detail_list(nvme_root_t r)
                                uint64_t nsze = nvme_ns_get_lba_count(n) * lba;
                                uint64_t nuse = nvme_ns_get_lba_util(n) * lba;
 
-                               obj_add_str(jns, namespace_str, nvme_ns_get_name(n));
-                               obj_add_str(jns, generic_str, nvme_ns_get_generic_name(n));
-                               obj_add_int(jns, nsid_str, nvme_ns_get_nsid(n));
+                               obj_add_str(jns, "Namespace", nvme_ns_get_name(n));
+                               obj_add_str(jns, "Generic", nvme_ns_get_generic_name(n));
+                               obj_add_int(jns, "NSID", nvme_ns_get_nsid(n));
                                obj_add_uint64(jns, "UsedBytes", nuse);
                                obj_add_uint64(jns, "MaximumLBA", nvme_ns_get_lba_count(n));
                                obj_add_uint64(jns, "PhysicalSize", nsze);
@@ -4120,12 +4067,12 @@ static struct json_object *json_list_item_obj(nvme_ns_t n)
        nvme_dev_full_path(n, devname, sizeof(devname));
        nvme_generic_full_path(n, genname, sizeof(genname));
 
-       root_add_int(namespace_str, nvme_ns_get_nsid(n));
+       root_add_int("Namespace", nvme_ns_get_nsid(n));
        root_add_str("DevicePath", devname);
        root_add_str("GenericPath", genname);
-       root_add_str(firmware_str, nvme_ns_get_firmware(n));
-       root_add_str(model_number_str, nvme_ns_get_model(n));
-       root_add_str(serial_number_str, nvme_ns_get_serial(n));
+       root_add_str("Firmware", nvme_ns_get_firmware(n));
+       root_add_str("Model number", nvme_ns_get_model(n));
+       root_add_str("Serial number", nvme_ns_get_serial(n));
        root_add_uint64("UsedBytes", nuse);
        root_add_uint64("MaximumLBA", nvme_ns_get_lba_count(n));
        root_add_uint64("PhysicalSize", nsze);
@@ -4187,7 +4134,7 @@ static unsigned int json_subsystem_topology_multipath(nvme_subsystem_t s,
                struct json_object *paths;
 
                ns_attrs = json_create_object();
-               obj_add_int(ns_attrs, nsid_str, nvme_ns_get_nsid(n));
+               obj_add_int(ns_attrs, "NSID", nvme_ns_get_nsid(n));
 
                paths = json_create_array();
                nvme_namespace_for_each_path(n, p) {
@@ -4196,10 +4143,10 @@ static unsigned int json_subsystem_topology_multipath(nvme_subsystem_t s,
                        nvme_ctrl_t c = nvme_path_get_ctrl(p);
 
                        path_attrs = json_create_object();
-                       obj_add_str(path_attrs, name_str, nvme_ctrl_get_name(c));
-                       obj_add_str(path_attrs, transport_str, nvme_ctrl_get_transport(c));
-                       obj_add_str(path_attrs, address_str, nvme_ctrl_get_address(c));
-                       obj_add_str(path_attrs, state_str, nvme_ctrl_get_state(c));
+                       obj_add_str(path_attrs, "Name", nvme_ctrl_get_name(c));
+                       obj_add_str(path_attrs, "Transport", nvme_ctrl_get_transport(c));
+                       obj_add_str(path_attrs, "Address", nvme_ctrl_get_address(c));
+                       obj_add_str(path_attrs, "State", nvme_ctrl_get_state(c));
                        obj_add_str(path_attrs, "ANAState", nvme_path_get_ana_state(p));
                        array_add_obj(paths, path_attrs);
                }
@@ -4224,21 +4171,21 @@ static void json_print_nvme_subsystem_topology(nvme_subsystem_t s,
                        struct json_object *ctrl;
 
                        ns_attrs = json_create_object();
-                       obj_add_int(ns_attrs, nsid_str, nvme_ns_get_nsid(n));
+                       obj_add_int(ns_attrs, "NSID", nvme_ns_get_nsid(n));
 
                        ctrl = json_create_array();
                        ctrl_attrs = json_create_object();
-                       obj_add_str(ctrl_attrs, name_str,
+                       obj_add_str(ctrl_attrs, "Name",
                                                     nvme_ctrl_get_name(c));
-                       obj_add_str(ctrl_attrs, transport_str,
+                       obj_add_str(ctrl_attrs, "Transport",
                                                     nvme_ctrl_get_transport(c));
-                       obj_add_str(ctrl_attrs, address_str,
+                       obj_add_str(ctrl_attrs, "Address",
                                                     nvme_ctrl_get_address(c));
-                       obj_add_str(ctrl_attrs, state_str,
+                       obj_add_str(ctrl_attrs, "State",
                                                     nvme_ctrl_get_state(c));
 
                        array_add_obj(ctrl, ctrl_attrs);
-                       obj_add_array(ns_attrs, controller_str, ctrl);
+                       obj_add_array(ns_attrs, "Controller", ctrl);
                        array_add_obj(namespaces, ns_attrs);
                }
        }
@@ -4259,11 +4206,11 @@ static void json_simple_topology(nvme_root_t r)
                obj_add_str(host_attrs, "HostNQN", nvme_host_get_hostnqn(h));
                hostid = nvme_host_get_hostid(h);
                if (hostid)
-                       obj_add_str(host_attrs, host_id_str, hostid);
+                       obj_add_str(host_attrs, "Host ID", hostid);
                subsystems = json_create_array();
                nvme_for_each_subsystem(h, s) {
                        subsystem_attrs = json_create_object();
-                       obj_add_str(subsystem_attrs, name_str, nvme_subsystem_get_name(s));
+                       obj_add_str(subsystem_attrs, "Name", nvme_subsystem_get_name(s));
                        obj_add_str(subsystem_attrs, "NQN", nvme_subsystem_get_nqn(s));
                        obj_add_str(subsystem_attrs, "IOPolicy", nvme_subsystem_get_iopolicy(s));
 
@@ -4293,31 +4240,31 @@ static void json_directive_show_fields_identify(__u8 doper, __u8 *field, struct
                support = json_create_array();
                root_add_array("Directive support", support);
                obj_add_str(support, "Identify Directive",
-                           *field & 0x1 ? supported_str : not_supported_str);
+                           *field & 0x1 ? "Supported" : "Not supported");
                obj_add_str(support, "Stream Directive",
-                           *field & 0x2 ? supported_str : not_supported_str);
+                           *field & 0x2 ? "Supported" : "Not supported");
                obj_add_str(support, "Data Placement Directive",
-                           *field & 0x4 ? supported_str : not_supported_str);
+                           *field & 0x4 ? "Supported" : "Not supported");
                enabled = json_create_array();
                root_add_array("Directive enabled", enabled);
                obj_add_str(enabled, "Identify Directive",
-                           *(field + 32) & 0x1 ? enabled_str : disabled_str);
+                           *(field + 32) & 0x1 ? "Enabled" : "Disabled");
                obj_add_str(enabled, "Stream Directive",
-                           *(field + 32) & 0x2 ? enabled_str : disabled_str);
+                           *(field + 32) & 0x2 ? "Enabled" : "Disabled");
                obj_add_str(enabled, "Data Placement Directive",
-                           *(field + 32) & 0x4 ? enabled_str : disabled_str);
+                           *(field + 32) & 0x4 ? "Enabled" : "Disabled");
                persistent = json_create_array();
                obj_add_array(root, "Directive Persistent Across Controller Level Resets",
                              persistent);
                obj_add_str(persistent, "Identify Directive",
-                           *(field + 32) & 0x1 ? enabled_str : disabled_str);
+                           *(field + 32) & 0x1 ? "Enabled" : "Disabled");
                obj_add_str(persistent, "Stream Directive",
-                           *(field + 32) & 0x2 ? enabled_str : disabled_str);
+                           *(field + 32) & 0x2 ? "Enabled" : "Disabled");
                obj_add_str(persistent, "Data Placement Directive",
-                           *(field + 32) & 0x4 ? enabled_str : disabled_str);
+                           *(field + 32) & 0x4 ? "Enabled" : "Disabled");
                break;
        default:
-               root_add_str(error_str, "invalid directive operations for Identify Directives");
+               root_add_str("Error", "invalid directive operations for Identify Directives");
                break;
        }
 }
@@ -4354,7 +4301,7 @@ static void json_directive_show_fields_streams(__u8 doper,  unsigned int result,
                root_add_uint("Namespace Streams Allocated (NSA)", result & 0xffff);
                break;
        default:
-               root_add_str(error_str,
+               root_add_str("Error",
                                             "invalid directive operations for Streams Directives");
                break;
        }
@@ -4371,7 +4318,7 @@ static void json_directive_show_fields(__u8 dtype, __u8 doper, unsigned int resu
                json_directive_show_fields_streams(doper, result, (__u16 *)field, root);
                break;
        default:
-               root_add_str(error_str, "invalid directive type");
+               root_add_str("Error", "invalid directive type");
                break;
        }
 }
@@ -4384,13 +4331,13 @@ static void json_directive_show(__u8 type, __u8 oper, __u16 spec, __u32 nsid, __
        char json_str[STR_LEN];
 
        sprintf(json_str, "%#x", type);
-       root_add_str(type_str, json_str);
+       root_add_str("Type", json_str);
        sprintf(json_str, "%#x", oper);
-       root_add_str(operation_str, json_str);
+       root_add_str("Operation", json_str);
        sprintf(json_str, "%#x", spec);
        root_add_str("spec", json_str);
        sprintf(json_str, "%#x", nsid);
-       root_add_str(nsid_str, json_str);
+       root_add_str("NSID", json_str);
        sprintf(json_str, "%#x", result);
        root_add_result(json_str);
 
@@ -4399,7 +4346,7 @@ static void json_directive_show(__u8 type, __u8 oper, __u16 spec, __u32 nsid, __
        } else if (buf) {
                data = json_create_array();
                d_json((unsigned char *)buf, len, 16, 1, data);
-               root_add_array(data_str, data);
+               root_add_array("Data", data);
        }
 
        json_print(root);
@@ -4422,7 +4369,7 @@ static void json_discovery_log(struct nvmf_discovery_log *log, int numrec)
                obj_add_str(entry, "adrfam", nvmf_adrfam_str(e->adrfam));
                obj_add_str(entry, "subtype", nvmf_subtype_str(e->subtype));
                obj_add_str(entry,"treq", nvmf_treq_str(e->treq));
-               obj_add_uint(entry, port_id_str, le16_to_cpu(e->portid));
+               obj_add_uint(entry, "Port ID", le16_to_cpu(e->portid));
                obj_add_str(entry, "trsvcid", e->trsvcid);
                obj_add_str(entry, "subnqn", e->subnqn);
                obj_add_str(entry, "traddr", e->traddr);
@@ -4451,7 +4398,7 @@ static void json_connect_msg(nvme_ctrl_t c)
 {
        struct json_object *root = json_create_object();
 
-       root_add_str(device_str, nvme_ctrl_get_name(c));
+       root_add_str("Device", nvme_ctrl_get_name(c));
 
        json_print(root);
 }
@@ -4468,7 +4415,7 @@ static void json_output_status(int status)
        int type;
 
        if (status < 0) {
-               root_add_str(error_str, nvme_strerror(errno));
+               root_add_str("Error", nvme_strerror(errno));
                return json_output_object(root);
        }
 
@@ -4477,19 +4424,19 @@ static void json_output_status(int status)
 
        switch (type) {
        case NVME_STATUS_TYPE_NVME:
-               root_add_str(error_str, nvme_status_to_string(val, false));
-               root_add_str(type_str, "nvme");
+               root_add_str("Error", nvme_status_to_string(val, false));
+               root_add_str("Type", "nvme");
                break;
        case NVME_STATUS_TYPE_MI:
-               root_add_str(error_str, nvme_mi_status_to_string(val));
-               root_add_str(type_str, "nvme-mi");
+               root_add_str("Error", nvme_mi_status_to_string(val));
+               root_add_str("Type", "nvme-mi");
                break;
        default:
-               root_add_str(type_str, unknow_str);
+               root_add_str("Type", "Unknown");
                break;
        }
 
-       root_add_int(value_str, val);
+       root_add_int("Value", val);
 
        json_output_object(root);
 }
@@ -4498,7 +4445,7 @@ static void json_output_message(bool error, const char *msg, va_list ap)
 {
        struct json_object *root = json_create_object();
        char *value;
-       const char *key = error ? error_str : result_str;
+       const char *key = error ? "Error" : "Result";
 
        if (vasprintf(&value, msg, ap) < 0)
                value = NULL;
@@ -4522,9 +4469,9 @@ static void json_output_perror(const char *msg)
                error = NULL;
 
        if (error)
-               root_add_str(error_str, error);
+               root_add_str("Error", error);
        else
-               root_add_str(error_str, "Could not allocate string");
+               root_add_str("Error", "Could not allocate string");
 
        json_output_object(root);