parseSemanticTimeline

Parse JSON string to SemanticTimeline object.

This method efficiently parses Google Takeout Semantic Location History JSON data using cached adapters for optimal performance on repeated calls.

Return

Parsed SemanticTimeline object

Parameters

json

The JSON string containing SemanticTimeline data

Throws

JsonDataException

if the JSON is malformed or missing required fields

if json parameter is null

// Sample usage of parser to parse semantic timeline JSON.
val parser = Parser()
val json: String = File("your-file.json").bufferedReader().readText()
val semanticTimeline: SemanticTimeline = parser.parseSemanticTimeline(json)

println("Got semantic timeline: ${semanticTimeline.timelineObjects.size} objects.")

fun parseSemanticTimeline(bufferedSource: BufferedSource): SemanticTimeline

Parse JSON buffered source to SemanticTimeline object.

This method efficiently parses Google Takeout Semantic Location History JSON data using cached adapters and is recommended for large files as it provides better I/O performance.

Return

Parsed SemanticTimeline object

Parameters

bufferedSource

The BufferedSource containing SemanticTimeline JSON data

Throws

JsonDataException

if the JSON is malformed or missing required fields

if bufferedSource parameter is null

// Sample usage of parser to parse semantic timeline JSON.
val parser = Parser()
val bufferedSource: BufferedSource = File("your-file.json").source().buffer()
val semanticTimeline: SemanticTimeline = parser.parseSemanticTimeline(bufferedSource)

println("Got semantic timeline: ${semanticTimeline.timelineObjects.size} objects.")