gitee.com/quant1x/gox@v1.21.2/util/treemap/serialization.go (about) 1 // Copyright (c) 2015, Emir Pasic. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package treemap 6 7 import ( 8 "gitee.com/quant1x/gox/util/internal" 9 ) 10 11 func assertSerializationImplementation() { 12 var _ internal.JSONSerializer = (*Map)(nil) 13 var _ internal.JSONDeserializer = (*Map)(nil) 14 } 15 16 // ToJSON outputs the JSON representation of the map. 17 func (m *Map) ToJSON() ([]byte, error) { 18 return m.tree.ToJSON() 19 } 20 21 // FromJSON populates the map from the input JSON representation. 22 func (m *Map) FromJSON(data []byte) error { 23 return m.tree.FromJSON(data) 24 }