Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

How to emit JSON for a class? #32

Closed
mslinn opened this Issue · 1 comment

2 participants

@mslinn

I'd like to be able to convert this class into JSON so it could be assigned to a JValue:

case class TextMatch(val workCellRef:ActorRef, val length:Int = 0, val startPos:Int = 0, val endPos:Int = 0)

The JSON would look like this:

{
  "TextMatch": {
    "workCellRef":"opaqueStuff", "length":123, "startPos":234, "endPos":456
  }
}

How can I do this?

I also need to turn a list of TextMatch objects into JSON, perhaps something like the following. Again, how would I do that so the list could be assigned to a JValue?

{ 
  [
    "TextMatch": {
      "workCellRef":"opaqueStuff", "length":123, "startPos":234, "endPos":456
    },
    "TextMatch": {
      "workCellRef":"opaqueStuff", "length":123, "startPos":234, "endPos":456
    },
    "TextMatch": {
      "workCellRef":"opaqueStuff", "length":123, "startPos":234, "endPos":456
    },
  ]
}

Thanks,

Mike

@jdegoes
Owner
@mslinn mslinn closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.