Package com.yahoo.data
Interface JsonProducer
-
- All Known Implementing Classes:
FeatureData
,PositionsData
,StructuredData
public interface JsonProducer
Generic API for classes that contain data representable as JSON.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default java.lang.String
toJson()
Convenience method equivalent to: writeJson(new StringBuilder()).toString()java.lang.StringBuilder
writeJson(java.lang.StringBuilder target)
Append the JSON representation of this object's data to a StringBuilder.
-
-
-
Method Detail
-
writeJson
java.lang.StringBuilder writeJson(java.lang.StringBuilder target)
Append the JSON representation of this object's data to a StringBuilder. Note that when passing compact=false the generated string will be human-readable and containing embedded newlines; also the exact indentation etc may change, so use compact=true for a canonical format.- Parameters:
target
- the StringBuilder to append to.- Returns:
- the target passed in is also returned (to allow chaining).
-
toJson
default java.lang.String toJson()
Convenience method equivalent to: writeJson(new StringBuilder()).toString()- Returns:
- a String containing JSON representation of this object's data.
-
-