getting exception while reading JSON response

86 Views Asked by At

I am getting exception while reading JSON response which is provided by HTTPBuilder in Groovy. please find the JSON string below. I am getting JSON response without quotes. I am using Groovy HTTPBuilder.

String x = {
  apenvironments = [], temptype = dflt, audit = {
      createdAt = 1438605399389,
        createdBy = xxxxxx testing
    }, basicInfo = {
      id = AU7zkFVftRWGykHHiM1R,
        name = MED_FREQ83282
    }, id = AU7zkFVftRWGykHHiM1R, name = MED_FREQ83282,
    policyElements = [{
      authenticationType = AUTH12, type = AUTH
    }, {
      aggType = COUNT, soft = false, targets = [{
        targetType = APPS, type = BasePolicyElementTarget
      }], type = numrclmt, value = 5, valueEqualsZero = false
    }, {
      aggType = COUNT, soft = false, targets = [{
        targetType = DEVICE, type = BasePolicyElementTarget
      }], type = numerratlimt, value = 3, valueEqualsZero = false
    }, {
      enabled = true, type = ANALYTICS
    }, {
      meteringPayloadType = REQUEST, metricField = PAYLOAD, type = PAYLOAD_METERING
    }, {
      field = PAYLOAD, load = {
        bandwidthUnit = KB, payloadType = REQUEST, type = payload, value = 26
      }, soft = false, type = Payload, valueEqualsZero = false
    }, {
      aggType = COUNT, soft = false, targets = [{
        targetType = USER, type = elementTarget
      }], type = ratelt, value = 4, valueEqualsZero = false
    }, {
      hitType = ALL, metricField = HITS, type = meter
    }, {
      frequencyUnit = MINUTE, hits = {
        hitType = ALL, hits = 3
      }, metricField = HITS, soft = false, type = freqratelt, valueEqualsZero = false
    }], templateName = tempv, type = plctem
};      


ObjectMapper mapper = new ObjectMapper();

try {
    JsonNode df=mapper.readValue(x,JsonNode.class);

...............

Exception: com.fasterxml.jackson.core.JsonParseException: Unexpected character ('a' (code 97)): was expecting double-quote to start field name

Please help me on this.

0

There are 0 best solutions below