I have a string which looks something like

 [value] [value1] [value2] [value3 ] [key] : value key: key2: value5 
 key3: {JSON Object}

I want to extract only the JSON object after key3 from the string.

closed as off-topic by Kuba Nov 11 at 20:57

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question cannot be answered without additional information. Questions on problems in code must describe the specific problem and include valid code to reproduce it. Any data used for programming examples should be embedded in the question or code to generate the (fake) data must be included." – Kuba
If this question can be reworded to fit the rules in the help center, please edit the question.

  • ImportString["...","JSON"], then extracting what is required from that expression should be much easier. – user6014 Nov 11 at 0:29
  • ImportString[stringVal, "JSON"] keeps giving me error.. – developer Nov 11 at 0:37
  • 1
    If you have malformed data you'll need to clean it. This should do: ImportString[StringSplit[..., "key3:", 2][[-1]], "JSON"] – b3m2a1 Nov 11 at 0:49
  • That works. Thanks. StringSplit[..., "key3:", 2] will divide the input into two elements. But can you explain the role of [[-1]] after string split? – developer Nov 11 at 2:05
  • 1
    There is not a single string posted. So please at first post your string. – Αλέξανδρος Ζεγγ Nov 11 at 7:21