#community-help

Resolving Java Spring Boot Popup Issue and Conversion of JSON Array to JSON lines

TLDR Vasudev experienced issues with a jar file for java in a Spring Boot project and querying about processing of JSON arrays. Kishore Nallan clarified the need for JSON lines and offered advice for conversion using a string array.

Powered by Struct AI
Jul 27, 2022 (17 months ago)
Vasudev
Photo of md5-591a0ac3f5f7ef9eb6e6fc35534beeae
Vasudev
09:59 AM
i have imported jar file for java and used in the spring boot but i am getting an infinite popup with this data, how i am supposed to resolve it ?
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
12:15 PM
These log lines don't seem to be related to Typesense.
Vasudev
Photo of md5-591a0ac3f5f7ef9eb6e6fc35534beeae
Vasudev
01:28 PM
Resolved, logging issue...
01:55
Vasudev
01:55 PM
Is there a way where we can pass JSON array instead of json lines as you mentioned in the documentation
String documentList = "{\"countryName\": \"India\", \"capital\": \"Washington\", \"gdp\": 5215}\n" +
                      "{\"countryName\": \"Iran\", \"capital\": \"London\", \"gdp\": 5215}";
// Import your document as JSONL string from a file.
client.collections("countries").documents().import_(documentList, queryParameters)

Jul 28, 2022 (17 months ago)
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
07:09 AM
No, you have to send via json lines. Some clients support a wrapper that can do this for you, but don't think the Java client has that.
Vasudev
Photo of md5-591a0ac3f5f7ef9eb6e6fc35534beeae
Vasudev
09:43 AM
i have checked some resources but not able to find out how to convert a array of json object to jsonline formate
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
10:16 AM
Convert each object to json string, so end up with Array of string. Then you have to join array elements with new line separator, e.g like this: https://stackoverflow.com/questions/1978933/a-quick-and-easy-way-to-join-array-elements-with-a-separator-the-opposite-of-sp