i am getting following string from POST. i want to convert this string in to array. please help me how i can do this?

[{Product Id=3423654000000343061, Discount=0.00, Line Tax=Sales Tax===0:::0;;;, Product Name=.5mL (Sunset Sherbet), Quantity=100.0, Tax=0.00, Total After Discount=1450.0, Net Total=1450.00, Quantity in Stock=597.0, Total=1450.00, List Price=14.50, Unit Price=16.0, Product Description=.5mL / 0.016 fl. oz.}]
  • An array of what? String, or Product2 object, or something else? Please edit your original post to include more details. – David Cheng Sep 18 '18 at 19:37

What format do you need? By the case you wanna split by , you can do something like this:

String str = '[{ ...... }]';
str = str.right(str.length()-2);
str = str.left(str.length()-2);
String[] listStr = str.split(',');

Anyway it could be worthier using a wrapper or JSON.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.