lordsocke Posted May 27, 2018 Share Posted May 27, 2018 Hi there, Im using the google OCR textdetection. In the response I want to take out just all the written text. The response is coming like this: "text": "t" } ] } ] } ], "blockType": "TEXT" } ] } ], "text": "I´m the wanted\npart, of, the, respons\n1\nI´m the wanted part of the respons 2\nI´m the wanted part of the respons 3\nI´m the wanted part of the respons 4\n" } } ] } or "text": "g" } ] } ] } ], "blockType": "TEXT" } ] } ], "text": "I´m the wanted\npart of\nthe respons 1?\nI´m the wanted part of the respons 2\nI´m the wanted part of the respons 3\I´m the wanted part of the respons 4\n" } } ] } or "text": "h" } ] } ] } ], "blockType": "TEXT" } ] } ], "text": "I´m the wanted part of the\nresponse 1?\nI´m some unwanted crap\nI´m the wanted part of the respons 2\I´m the wanted part of the respons 3\nI´m the wanted part of the respons 4\n" } } ] } These are some examples how the respond parts can look like. My problem, that I just want a way that I only get the marked parts in this way. $string1 = I´m the wanted part of the respons 1 $string2 = I´m the wanted part of the respons 2 $string3 = I´m the wanted part of the respons 3 $string4 = I´m the wanted part of the respons 4 So what is changing: variable number of wordwraps (\n) the length of every string can be between 1 and 99 between part1 and part2 can be some unwanted shit (looks always the same) Thanks for everybody, I know this looks totally wired. Is there maybe a function that can just deliver the recived text as so many strings as wordwraps are in there? Link to comment Share on other sites More sharing options...
TheXman Posted May 27, 2018 Share Posted May 27, 2018 It looks like the API response is standard JSON. You can use the UDF found HERE to parse the JSON and get the text objects. Or, if you are good with regular expressions, you can use them to parse out the text. Once you've got the text, you can use StringSplit to separate the lines, base on the "\n", into an array. From there, process the array items as you like. CryptoNG UDF: Cryptography API: Next Gen jq UDF: Powerful and Flexible JSON Processor | jqPlayground: An Interactive JSON Processor Xml2Json UDF: Transform XML to JSON | HttpApi UDF: HTTP Server API | Roku Remote: Example Script About Me How To Ask Good Questions On Technical And Scientific Forums (Detailed) | How to Ask Good Technical Questions (Brief) "Any fool can know. The point is to understand." -Albert Einstein "If you think you're a big fish, it's probably because you only swim in small ponds." ~TheXman Link to comment Share on other sites More sharing options...
lordsocke Posted May 28, 2018 Author Share Posted May 28, 2018 Thanks a lot!!! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now