@@ -264,15 +264,13 @@ void G3Frame::save(A &ar, unsigned v) const
264264 ar << make_nvp (" crc" , crc);
265265}
266266
267- template <typename T>
268- void G3Frame::saveJSON (T & os) const
269- {
270267#ifdef SPT3G_ENABLE_JSON_OUTPUT
268+ template <>
269+ void G3Frame::save (cereal::JSONOutputArchive &ar, unsigned v) const
270+ {
271271 using cereal::make_nvp;
272- uint32_t version ( 1 ), size (map_.size ());
272+ uint32_t size (map_.size ());
273273
274- cereal::JSONOutputArchive ar (os);
275- ar << make_nvp (" version" , version);
276274 ar << make_nvp (" size" , size);
277275 std::string typestr (1 ,(char ) type);
278276 ar << make_nvp (" type" , typestr);
@@ -282,16 +280,19 @@ void G3Frame::saveJSON(T & os) const
282280 ar << make_nvp (" name" , i->first );
283281 ar << make_nvp (" val" , i->second .frameobject );
284282 }
285- #else
286- os << " {error: \" spt3g-software compiled without JSON support\" }" << std::endl;
287- #endif
288283}
284+ #endif
289285
290286std::string
291287G3Frame::asJSON () const
292288{
293289 std::stringstream str;
294- saveJSON (str);
290+ #ifdef SPT3G_ENABLE_JSON_OUTPUT
291+ cereal::JSONOutputArchive ar (str);
292+ ar << cereal::make_nvp (" frame" , *this );
293+ #else
294+ str << " {error: \" spt3g_software compiled without JSON support\" }" << std::endl;
295+ #endif
295296 return str.str ();
296297}
297298
@@ -425,10 +426,6 @@ template void G3Frame::saves(std::ostringstream &) const;
425426
426427G3_SPLIT_SERIALIZABLE_CODE (G3Frame);
427428
428- template void G3Frame::saveJSON (std::ostream &) const ;
429- template void G3Frame::saveJSON (std::ostringstream &) const ;
430- template void G3Frame::saveJSON (boost::iostreams::filtering_ostream &) const ;
431-
432429G3FramePtr
433430g3frame_char_constructor (std::string max_4_chars)
434431{
0 commit comments