@@ -604,14 +604,33 @@ std::string Nuclide::writeAsCSV(std::string_view sep) const
604
604
}
605
605
606
606
607
- std::string Nuclide::writeAsJSON () const
607
+ std::string Nuclide::writeAsJSON (const bool human_readable ) const
608
608
{
609
- return fmt::format (" {{\" A\" :{},\" Z\" :{},\" N\" :{},\" Symbol\" :\" {}\" ,\" Decay\" :\" {}\" ,\" Experimental\" :{},\" Own\" :{},"
610
- " \" NubaseMassExcess\" :{},\" ErrorNubaseMassExcess\" :{},\" AMEMassExcess\" :{},\" ErrorAMEMassExcess\" :"
611
- " {},\" HalfLife\" :{},\" SingleNeutronSeparationEnergy\" :{},\" ErrorSingleNeutronSeparationEnergy\" :{}"
612
- " ,\" SingleProtonSeparationEnergy\" :{},\" ErrorSingleProtonSeparationEnergy\" :{},"
613
- " \" DoubleNeutronSeparationEnergy\" :{},\" ErrorDoubleNeutronSeparationEnergy\" :{},"
614
- " \" DoubleProtonSeparationEnergy\" :{},\" ErrorDoubleProtonSeparationEnergy\" :{},\" Year\" :{}}}" ,
609
+ // Data files go to 4dp so we'll print the same
610
+ return fmt::format (" {{{0}"
611
+ " \" A\" :{1},{0}"
612
+ " \" Z\" :{2},{0}"
613
+ " \" N\" :{3},{0}"
614
+ " \" Symbol\" :\" {4}\" ,{0}"
615
+ " \" Decay\" :\" {5}\" ,{0}"
616
+ " \" Experimental\" :{6},{0}"
617
+ " \" Own\" :{7},{0}"
618
+ " \" NubaseMassExcess\" :{8:.4f},{0}"
619
+ " \" ErrorNubaseMassExcess\" :{9:.4f},{0}"
620
+ " \" AMEMassExcess\" :{10:.4f},{0}"
621
+ " \" ErrorAMEMassExcess\" :{11:.4f},{0}"
622
+ " \" HalfLife\" :{12:.3e},{0}"
623
+ " \" SingleNeutronSeparationEnergy\" :{13:.4f},{0}"
624
+ " \" ErrorSingleNeutronSeparationEnergy\" :{14:.4f},{0}"
625
+ " \" SingleProtonSeparationEnergy\" :{15:.4f},{0}"
626
+ " \" ErrorSingleProtonSeparationEnergy\" :{16:.4f},{0}"
627
+ " \" DoubleNeutronSeparationEnergy\" :{17:.4f},{0}"
628
+ " \" ErrorDoubleNeutronSeparationEnergy\" :{18:.4f},{0}"
629
+ " \" DoubleProtonSeparationEnergy\" :{19:.4f},{0}"
630
+ " \" ErrorDoubleProtonSeparationEnergy\" :{20:.4f},{0}"
631
+ " \" Year\" :{21}{0}"
632
+ " }}" ,
633
+ human_readable ? " \n " : " " ,
615
634
A,
616
635
Z,
617
636
N,
0 commit comments