MarshalJSON Reviles ConcurrentMap "private" variables to json marshal.
()
| 439 | |
| 440 | // MarshalJSON Reviles ConcurrentMap "private" variables to json marshal. |
| 441 | func (slm ShardLockMaps) MarshalJSON() ([]byte, error) { |
| 442 | tmp := make(map[string]interface{}) |
| 443 | |
| 444 | for item := range slm.IterBuffered() { |
| 445 | tmp[item.Key] = item.Val |
| 446 | } |
| 447 | return json.Marshal(tmp) |
| 448 | } |
| 449 | |
| 450 | // UnmarshalJSON Reverse process of Marshal. |
| 451 | func (slm ShardLockMaps) UnmarshalJSON(b []byte) (err error) { |