Sha256: b34859305edcadff18767214ad5785cccbf545ff241485ca236cb3c8391744c1

Contents?: true

Size: 526 Bytes

Versions: 2

Compression:

Stored size: 526 Bytes

Contents

package org.embulk.formatter.fast_jsonl.json

import io.circe.Json
import io.circe.parser._

object JsonParser {
  def apply(value: String): Seq[(String, Json)] =
    decode[Map[String, Json]](value) match {
      case Right(v: Map[String, Json]) =>
        v.toIterator.toSeq
      case _ =>
        sys.error(s"could not parse json. $value")
    }

  def toJson(value: String): Json = {
    parse(value) match {
      case Right(v) =>
        v
      case _ =>
        sys.error(s"could not parse json. $value")
    }
  }
}

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
embulk-formatter-fast_jsonl-0.1.2 src/main/scala/org/embulk/formatter/fast_jsonl/json/JsonParser.scala
embulk-formatter-fast_jsonl-0.1.1 src/main/scala/org/embulk/formatter/fast_jsonl/json/JsonParser.scala