Nitin Rathod
Nitin Rathod

Reputation: 161

Gson.toJson() method returns string embedded with "data"

I am working on Workfusion which is one of the automation tool and it consists of selenium, java and Web -harvest technology. Below is the snipped of my code.

  <while condition="${continue_flg}" maxloops="${full_data.size()-1}"
          index="ind">
          <script><![CDATA[
                 import com.google.gson.Gson;
                 Gson gson = new Gson();
                 LinkedHashMap recMapTemp1 = full_data[ind.toInt()];
                 println "*****"+recMapTemp1; // Contains key value map
                 jsonValueMap = gson.toJson(recMapTemp1);
                 println "*****"+jsonValueMap; // "data" is added before value
          ]]></script>

          <insert-datastore datastore-name="Fallout_type"
                 json-value-map="${jsonValueMap}" create="true" />
   </while>

In map Key is "ship to ctry cd" and Value is "AT" but after converting toJson String it gives as below. I dont need this data word i need normal Json Value.

"ship to ctry cd":{"data":"AT"},

Upvotes: 0

Views: 103

Answers (1)

Pramod S. Nikam
Pramod S. Nikam

Reputation: 4541

you can do :

println "*****"+jsonValueMap.data; 

to achieve that

Upvotes: 0

Related Questions