Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions Plugins/JSONImportPlugin/JSONImportPlugin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,10 @@ final class JSONImportPlugin: ImportFormatPlugin, SettablePlugin {
inserted: &inserted, skipped: &skipped, errors: &errors, maxErrors: maxErrors)
}
} else {
let rows = try Self.parseRows(at: url, targetTable: sink.targetTable)
for (index, row) in rows.enumerated() {
let rawRows = try Self.parseRows(at: url, targetTable: sink.targetTable)
for (index, rawRow) in rawRows.enumerated() {
try progress.checkCancellation()
try await insert(row, into: sink, at: index + 1, progress: progress,
try await insert(Self.convertRow(rawRow), into: sink, at: index + 1, progress: progress,
inserted: &inserted, skipped: &skipped, errors: &errors, maxErrors: maxErrors)
}
}
Expand Down Expand Up @@ -145,10 +145,10 @@ final class JSONImportPlugin: ImportFormatPlugin, SettablePlugin {
return convertRow(dict)
}

static func parseRows(at url: URL, targetTable: String?) throws -> [[String: PluginCellValue]] {
static func parseRows(at url: URL, targetTable: String?) throws -> [[String: Any]] {
let data = try Data(contentsOf: url)
let object = try JSONSerialization.jsonObject(with: data)
return try extractRows(from: object, targetTable: targetTable).map(convertRow)
return try extractRows(from: object, targetTable: targetTable)
}

static func extractRows(from object: Any, targetTable: String?) throws -> [[String: Any]] {
Expand Down
Loading