@@ -376,38 +376,6 @@ class Value : public std::enable_shared_from_this<Value> {
376376    throw  std::runtime_error (" get<T> not defined for this value type: "   + dump ());
377377  }
378378
379-   template  <>
380-   json get<json>() const  {
381-     if  (is_primitive ()) return  primitive_;
382-     if  (is_null ()) return  json ();
383-     if  (array_) {
384-       std::vector<json> res;
385-       for  (const  auto & item : *array_) {
386-         res.push_back (item.get <json>());
387-       }
388-       return  res;
389-     }
390-     if  (object_) {
391-       json res = json::object ();
392-       for  (const  auto & item : *object_) {
393-         const  auto  & key = item.first ;
394-         auto  json_value = item.second .get <json>();
395-         if  (key.is_string ()) {
396-           res[key.get <std::string>()] = json_value;
397-         } else  if  (key.is_primitive ()) {
398-           res[key.dump ()] = json_value;
399-         } else  {
400-           throw  std::runtime_error (" Invalid key type for conversion to JSON: "   + key.dump ());
401-         }
402-       }
403-       if  (is_callable ()) {
404-         res[" __callable__"  ] = true ;
405-       }
406-       return  res;
407-     }
408-     throw  std::runtime_error (" get<json> not defined for this value type: "   + dump ());
409-   }
410- 
411379  std::string dump (int  indent=-1 , bool  to_json=false ) const  {
412380    std::ostringstream out;
413381    dump (out, indent, 0 , to_json ? ' "'   : ' \' '  );
@@ -466,6 +434,38 @@ class Value : public std::enable_shared_from_this<Value> {
466434  }
467435};
468436
437+ template  <>
438+ json Value::get<json>() const  {
439+   if  (is_primitive ()) return  primitive_;
440+   if  (is_null ()) return  json ();
441+   if  (array_) {
442+     std::vector<json> res;
443+     for  (const  auto & item : *array_) {
444+       res.push_back (item.get <json>());
445+     }
446+     return  res;
447+   }
448+   if  (object_) {
449+     json res = json::object ();
450+     for  (const  auto & item : *object_) {
451+       const  auto  & key = item.first ;
452+       auto  json_value = item.second .get <json>();
453+       if  (key.is_string ()) {
454+         res[key.get <std::string>()] = json_value;
455+       } else  if  (key.is_primitive ()) {
456+         res[key.dump ()] = json_value;
457+       } else  {
458+         throw  std::runtime_error (" Invalid key type for conversion to JSON: "   + key.dump ());
459+       }
460+     }
461+     if  (is_callable ()) {
462+       res[" __callable__"  ] = true ;
463+     }
464+     return  res;
465+   }
466+   throw  std::runtime_error (" get<json> not defined for this value type: "   + dump ());
467+ }
468+ 
469469} //  namespace minja
470470
471471namespace  std  {
0 commit comments