Commit 2ce64514 authored by Philipp Schäfer's avatar Philipp Schäfer
Browse files

UtilsJSON: added some missing tags/names of root nodes

parent c2e80d3b
......@@ -17,7 +17,8 @@ void ITABase::Utils::JSON::Export(const CITASpectrum* pSpectrum, const std::stri
json jSpectrum;
for ( int i = 0; i < pSpectrum->GetNumBands ( ); i++ )
{
jSpectrum.push_back ( { { "center_frequency", pSpectrum->GetCenterFrequencies ( )[i] }, { "value", pSpectrum->GetValues ( )[i] } } );
//TODO: Why use tags for the bin index. Better would be a simple array ( jSpectrum.push_back() )
jSpectrum["bin" + std::to_string ( i )] = { { "center_frequency", pSpectrum->GetCenterFrequencies ( )[i] }, { "value", pSpectrum->GetValues ( )[i] } };
}
jRoot["spectrum"] = jSpectrum;
......@@ -54,7 +55,10 @@ void ITABase::Utils::JSON::Export(const std::vector<ITABase::CStatistics>& voSta
{
json jRoot;
for ( auto& oStats : voStats )
jRoot.push_back ( StatsToJSON ( oStats ) );
{
// TODO: What happen if name is identical? Better would be a simple array ( jRoot.push_back() )
jRoot[oStats.sName] = StatsToJSON ( oStats );
}
std::ofstream fsOut ( sTargetFilePath );
fsOut << jRoot.dump ( JSON_INDENT );
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment