Results 1 to 2 of 2

Thread: Expression language support for JSON

  1. #1
    Join Date
    Mar 2011
    Posts
    5

    Default Expression language support for JSON

    In Mule 3, I can have a string payload that consists of JSON and I can do expression language operations on it.

    For example,
    Code:
    expression="#[json:job/state]"
    retrieves the job state and uses it for a routing descision.

    In Spring Integration, I have found that the expression language only seems to support java objects,
    e.g.
    Code:
    exchange-name-expression="payload"
    If payload is a string, then I can only to String operations on it.
    The use case I have is that I want to dynamically route messages to a given exchange (in AMQP) based
    on the message contents.

    Is there support for this?

    Obviously in my service, I could convert the JSON string to a Java JSONObject, but then the outbound adapter would have to serialize back.

    Any other ideas would be welcome.

    Earl

  2. #2
    Join Date
    Aug 2005
    Location
    Atlanta
    Posts
    124

    Default

    Hi Earl,

    Thanks for bringing this up. We certainly need to improve our JSON support to cover your use-case. Consequently I have created a Jira to add support for JsonPath:

    https://jira.springsource.org/browse/INTEXT-29

    My thoughts right now, would be to provide Adapters similar to the XPath support we have, adding JSon specific Routers, Enrichers and Filters. I am not so sure, yet, regarding adding support directly into SpEL.

    Please let us know any additional thoughts you have.

    Cheers,

    Gunnar
    Gunnar Hillert
    SpringSource/VMWare, Spring Integration team
    SpringSource Team - Spring Training, Consulting, and Support - "From the Source"
    http://twitter.com/ghillert
    http://blog.hillert.com/
    http://blog.springsource.com/author/ghillert/

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •