All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.openprovenance.prov.scala.query.JsonSupport.scala Maven / Gradle / Ivy

There is a newer version: 2.2.1
Show newest version
package org.openprovenance.prov.scala.query

import com.fasterxml.jackson.databind.ObjectMapper


object JsonSupport {
  val om: ObjectMapper =new ObjectMapper()

  def toJsonSentence(s: Map[String,Object]): String = {
    om.writeValueAsString(s)
  }

  def fromJson(s:String): Map[String,Object] = {
    val m = om.readValue(s, classOf[Map[String,Object]])
    m
  }

  def extractPotentialJSon(s: String): Object = {
    if (s.startsWith("{")) fromJson(s) else s
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy