0

dataweave 2.0 script in Anypoint Studio 7.3 while building JSON always add quotations to the object, even if it's not value but new JSON object.

My code looks like this:

%dw 2.0
output application/java
import * from dw::core::Strings
var studyId = vars.request.studyId
---
{[
    {
      (vars.keytype): value1,
      StudyId: value2
    },
    (vars.condition)
]}

where (vars.condition) is just another json object:

{"key1":"value"}

the Question is how to remove extra quotations surrounding (vars.condidtion)?

vc.0
  • 1
  • 2

1 Answers1

0

The most probable reason for it to add extra quotes is that your condition variable doesn't have the application/json mime-type set.

Shoki
  • 1,508
  • 8
  • 13
  • I've solved this problem with workaround in Java. Payload --> String --> String.replace(String, String) but I'm not happy about this. I had so many problems working on JSONs on Mule4... Thanks anyway. – vc.0 May 08 '19 at 08:29