diff --git a/gcc/analyzer/call-string.cc b/gcc/analyzer/call-string.cc
index 23880e3f5419..c404c09ca0df 100644
--- a/gcc/analyzer/call-string.cc
+++ b/gcc/analyzer/call-string.cc
@@ -111,12 +111,9 @@ call_string::to_json () const
   for (const call_string::element_t &e : m_elements)
     {
       json::object *e_obj = new json::object ();
-      e_obj->set ("src_snode_idx",
-		  new json::integer_number (e.m_callee->m_index));
-      e_obj->set ("dst_snode_idx",
-		  new json::integer_number (e.m_caller->m_index));
-      e_obj->set ("funcname",
-		  new json::string (function_name (e.m_caller->m_fun)));
+      e_obj->set_integer ("src_snode_idx", e.m_callee->m_index);
+      e_obj->set_integer ("dst_snode_idx", e.m_caller->m_index);
+      e_obj->set_string ("funcname", function_name (e.m_caller->m_fun));
       arr->append (e_obj);
     }
 
diff --git a/gcc/analyzer/constraint-manager.cc b/gcc/analyzer/constraint-manager.cc
index 29539060ebdd..62d3b84bb745 100644
--- a/gcc/analyzer/constraint-manager.cc
+++ b/gcc/analyzer/constraint-manager.cc
@@ -479,7 +479,7 @@ bounded_range::set_json_attr (json::object *obj, const char *name, tree value)
   pretty_printer pp;
   pp_format_decoder (&pp) = default_tree_printer;
   pp_printf (&pp, "%E", value);
-  obj->set (name, new json::string (pp_formatted_text (&pp)));
+  obj->set_string (name, pp_formatted_text (&pp));
 }
 
 
@@ -1140,7 +1140,7 @@ equiv_class::to_json () const
       pretty_printer pp;
       pp_format_decoder (&pp) = default_tree_printer;
       pp_printf (&pp, "%qE", m_constant);
-      ec_obj->set ("constant", new json::string (pp_formatted_text (&pp)));
+      ec_obj->set_string ("constant", pp_formatted_text (&pp));
     }
 
   return ec_obj;
@@ -1397,9 +1397,9 @@ constraint::to_json () const
 {
   json::object *con_obj = new json::object ();
 
-  con_obj->set ("lhs", new json::integer_number (m_lhs.as_int ()));
-  con_obj->set ("op", new json::string (constraint_op_code (m_op)));
-  con_obj->set ("rhs", new json::integer_number (m_rhs.as_int ()));
+  con_obj->set_integer ("lhs", m_lhs.as_int ());
+  con_obj->set_string ("op", constraint_op_code (m_op));
+  con_obj->set_integer ("rhs", m_rhs.as_int ());
 
   return con_obj;
 }
@@ -1485,7 +1485,7 @@ bounded_ranges_constraint::to_json () const
 {
   json::object *con_obj = new json::object ();
 
-  con_obj->set ("ec", new json::integer_number (m_ec_id.as_int ()));
+  con_obj->set_integer ("ec", m_ec_id.as_int ());
   con_obj->set ("ranges", m_ranges->to_json ());
 
   return con_obj;
diff --git a/gcc/analyzer/diagnostic-manager.cc b/gcc/analyzer/diagnostic-manager.cc
index 51304b0795b6..92e30bd049bd 100644
--- a/gcc/analyzer/diagnostic-manager.cc
+++ b/gcc/analyzer/diagnostic-manager.cc
@@ -746,17 +746,17 @@ saved_diagnostic::to_json () const
   json::object *sd_obj = new json::object ();
 
   if (m_sm)
-    sd_obj->set ("sm", new json::string (m_sm->get_name ()));
-  sd_obj->set ("enode", new json::integer_number (m_enode->m_index));
-  sd_obj->set ("snode", new json::integer_number (m_snode->m_index));
+    sd_obj->set_string ("sm", m_sm->get_name ());
+  sd_obj->set_integer ("enode", m_enode->m_index);
+  sd_obj->set_integer ("snode", m_snode->m_index);
   if (m_sval)
     sd_obj->set ("sval", m_sval->to_json ());
   if (m_state)
     sd_obj->set ("state", m_state->to_json ());
   if (m_best_epath)
-    sd_obj->set ("path_length", new json::integer_number (get_epath_length ()));
-  sd_obj->set ("pending_diagnostic", new json::string (m_d->get_kind ()));
-  sd_obj->set ("idx", new json::integer_number (m_idx));
+    sd_obj->set_integer ("path_length", get_epath_length ());
+  sd_obj->set_string ("pending_diagnostic", m_d->get_kind ());
+  sd_obj->set_integer ("idx", m_idx);
 
   /* We're not yet JSONifying the following fields:
      const gimple *m_stmt;
@@ -1038,7 +1038,7 @@ saved_diagnostic::maybe_add_sarif_properties (sarif_object &result_obj) const
   if (m_state)
     props.set (PROPERTY_PREFIX "state", m_state->to_json ());
   if (m_best_epath)
-  props.set (PROPERTY_PREFIX "idx", new json::integer_number (m_idx));
+  props.set_integer (PROPERTY_PREFIX "idx", m_idx);
 #undef PROPERTY_PREFIX
 
   /* Potentially add pending_diagnostic-specific properties.  */
diff --git a/gcc/analyzer/engine.cc b/gcc/analyzer/engine.cc
index c9f204b13e70..f4239753c91e 100644
--- a/gcc/analyzer/engine.cc
+++ b/gcc/analyzer/engine.cc
@@ -1449,10 +1449,9 @@ exploded_node::to_json (const extrinsic_state &ext_state) const
 
   enode_obj->set ("point", get_point ().to_json ());
   enode_obj->set ("state", get_state ().to_json (ext_state));
-  enode_obj->set ("status", new json::string (status_to_str (m_status)));
-  enode_obj->set ("idx", new json::integer_number (m_index));
-  enode_obj->set ("processed_stmts",
-		  new json::integer_number (m_num_processed_stmts));
+  enode_obj->set_string ("status", status_to_str (m_status));
+  enode_obj->set_integer ("idx", m_index);
+  enode_obj->set_integer ("processed_stmts", m_num_processed_stmts);
 
   return enode_obj;
 }
@@ -2298,8 +2297,8 @@ json::object *
 exploded_edge::to_json () const
 {
   json::object *eedge_obj = new json::object ();
-  eedge_obj->set ("src_idx", new json::integer_number (m_src->m_index));
-  eedge_obj->set ("dst_idx", new json::integer_number (m_dest->m_index));
+  eedge_obj->set_integer ("src_idx", m_src->m_index);
+  eedge_obj->set_integer ("dst_idx", m_dest->m_index);
   if (m_sedge)
     eedge_obj->set ("sedge", m_sedge->to_json ());
   if (m_custom_info)
@@ -2307,7 +2306,7 @@ exploded_edge::to_json () const
       pretty_printer pp;
       pp_format_decoder (&pp) = default_tree_printer;
       m_custom_info->print (&pp);
-      eedge_obj->set ("custom", new json::string (pp_formatted_text (&pp)));
+      eedge_obj->set_string ("custom", pp_formatted_text (&pp));
     }
   return eedge_obj;
 }
diff --git a/gcc/analyzer/program-point.cc b/gcc/analyzer/program-point.cc
index ea15ccc91d27..8e0a3a0e3be1 100644
--- a/gcc/analyzer/program-point.cc
+++ b/gcc/analyzer/program-point.cc
@@ -319,23 +319,20 @@ program_point::to_json () const
 {
   json::object *point_obj = new json::object ();
 
-  point_obj->set ("kind",
-		  new json::string (point_kind_to_string (get_kind ())));
+  point_obj->set_string ("kind", point_kind_to_string (get_kind ()));
 
   if (get_supernode ())
-    point_obj->set ("snode_idx",
-		    new json::integer_number (get_supernode ()->m_index));
+    point_obj->set_integer ("snode_idx", get_supernode ()->m_index);
 
   switch (get_kind ())
     {
     default: break;
     case PK_BEFORE_SUPERNODE:
       if (const superedge *sedge = get_from_edge ())
-	point_obj->set ("from_edge_snode_idx",
-			new json::integer_number (sedge->m_src->m_index));
+	point_obj->set_integer ("from_edge_snode_idx", sedge->m_src->m_index);
       break;
     case PK_BEFORE_STMT:
-      point_obj->set ("stmt_idx", new json::integer_number (get_stmt_idx ()));
+      point_obj->set_integer ("stmt_idx", get_stmt_idx ());
       break;
     }
 
diff --git a/gcc/analyzer/program-state.cc b/gcc/analyzer/program-state.cc
index c42fc752350a..b975184d33e6 100644
--- a/gcc/analyzer/program-state.cc
+++ b/gcc/analyzer/program-state.cc
@@ -1223,7 +1223,7 @@ program_state::to_json (const extrinsic_state &ext_state) const
     state_obj->set ("checkers", checkers_obj);
   }
 
-  state_obj->set ("valid", new json::literal (m_valid));
+  state_obj->set_bool ("valid", m_valid);
 
   return state_obj;
 }
diff --git a/gcc/analyzer/sm.cc b/gcc/analyzer/sm.cc
index f23a94b62438..f8b21b85db03 100644
--- a/gcc/analyzer/sm.cc
+++ b/gcc/analyzer/sm.cc
@@ -156,7 +156,7 @@ state_machine::to_json () const
 {
   json::object *sm_obj = new json::object ();
 
-  sm_obj->set ("name", new json::string (m_name));
+  sm_obj->set_string ("name", m_name);
   {
     json::array *states_arr = new json::array ();
     unsigned i;
diff --git a/gcc/analyzer/store.cc b/gcc/analyzer/store.cc
index 284866c7effc..c6c17b58d5c7 100644
--- a/gcc/analyzer/store.cc
+++ b/gcc/analyzer/store.cc
@@ -1444,8 +1444,8 @@ binding_cluster::to_json () const
 {
   json::object *cluster_obj = new json::object ();
 
-  cluster_obj->set ("escaped", new json::literal (m_escaped));
-  cluster_obj->set ("touched", new json::literal (m_touched));
+  cluster_obj->set_bool ("escaped", m_escaped);
+  cluster_obj->set_bool ("touched", m_touched);
   cluster_obj->set ("map", m_map.to_json ());
 
   return cluster_obj;
@@ -2705,7 +2705,7 @@ store::to_json () const
       store_obj->set (parent_reg_desc.get (), clusters_in_parent_reg_obj);
     }
 
-  store_obj->set ("called_unknown_fn", new json::literal (m_called_unknown_fn));
+  store_obj->set_bool ("called_unknown_fn", m_called_unknown_fn);
 
   return store_obj;
 }
diff --git a/gcc/analyzer/supergraph.cc b/gcc/analyzer/supergraph.cc
index 20c62856d4b6..68d83bb914a7 100644
--- a/gcc/analyzer/supergraph.cc
+++ b/gcc/analyzer/supergraph.cc
@@ -723,18 +723,17 @@ supernode::to_json () const
 {
   json::object *snode_obj = new json::object ();
 
-  snode_obj->set ("idx", new json::integer_number (m_index));
-  snode_obj->set ("bb_idx", new json::integer_number (m_bb->index));
+  snode_obj->set_integer ("idx", m_index);
+  snode_obj->set_integer ("bb_idx", m_bb->index);
   if (function *fun = get_function ())
-    snode_obj->set ("fun", new json::string (function_name (fun)));
+    snode_obj->set_string ("fun", function_name (fun));
 
   if (m_returning_call)
     {
       pretty_printer pp;
       pp_format_decoder (&pp) = default_tree_printer;
       pp_gimple_stmt_1 (&pp, m_returning_call, 0, (dump_flags_t)0);
-      snode_obj->set ("returning_call",
-		      new json::string (pp_formatted_text (&pp)));
+      snode_obj->set_string ("returning_call", pp_formatted_text (&pp));
     }
 
   /* Phi nodes.  */
@@ -990,15 +989,15 @@ json::object *
 superedge::to_json () const
 {
   json::object *sedge_obj = new json::object ();
-  sedge_obj->set ("kind", new json::string (edge_kind_to_string (m_kind)));
-  sedge_obj->set ("src_idx", new json::integer_number (m_src->m_index));
-  sedge_obj->set ("dst_idx", new json::integer_number (m_dest->m_index));
+  sedge_obj->set_string ("kind", edge_kind_to_string (m_kind));
+  sedge_obj->set_integer ("src_idx", m_src->m_index);
+  sedge_obj->set_integer ("dst_idx", m_dest->m_index);
 
   {
     pretty_printer pp;
     pp_format_decoder (&pp) = default_tree_printer;
     dump_label_to_pp (&pp, false);
-    sedge_obj->set ("desc", new json::string (pp_formatted_text (&pp)));
+    sedge_obj->set_string ("desc", pp_formatted_text (&pp));
   }
 
   return sedge_obj;
