github.com/mymmsc/gox@v1.3.33/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 "github.com/mymmsc/gox/util" 8 9 func assertSerializationImplementation() { 10 var _ util.JSONSerializer = (*Map)(nil) 11 var _ util.JSONDeserializer = (*Map)(nil) 12 } 13 14 // ToJSON outputs the JSON representation of the map. 15 func (m *Map) ToJSON() ([]byte, error) { 16 return m.tree.ToJSON() 17 } 18 19 // FromJSON populates the map from the input JSON representation. 20 func (m *Map) FromJSON(data []byte) error { 21 return m.tree.FromJSON(data) 22 }