0

After I consume the data from the SQS queue, I got a json output.But I have not saved this json output anywhere.Then I transformed the data received from SQS by jolt like this.

private Object toTransform(String message) {
        Object data = null;
        Object joltConverted;
        String spec = `spec string`;
        JoltTransformation joltTransformation;
        
        try {
            data = DATA_READER.readValue(message);
            joltTransformation=new JoltTransformation(data, spec);
            joltConverted=joltTransformation.joltConvert();

        } catch (Exception e) {
            LOGGER.error("Error decoding message", e);
            throw new RuntimeException(e);
        }
        return joltConverted;
    }

Then format of the json I received is as follows.

[ { "device_0":"04BC", "device_1":"02BA" }, { "device_2":"09AB", "device_3":"04BA" } ]

Now I wanted to convert these hexadecimal values to decimal values and update this Json object. How can I do this?

  • Part of the answer: "_convert these hexadecimal values to decimal values_": See [Converting some hexadecimal string to a decimal integer](https://stackoverflow.com/q/20110533/12567365) and related questions. – andrewJames Sep 30 '22 at 02:07
  • Minor points regarding your most recent edits: JSON is called JSON, not json or Json. See [json.org](https://www.json.org/json-en.html). You should also format your code and your JSON using the [code formatting support](https://meta.stackoverflow.com/q/251361/12567365) built into Stack Overflow. – andrewJames Oct 20 '22 at 12:36

0 Answers0