Resolving "Bad JSON" Error during Typesense Collection Creation
TLDR Cassandra had an error creating a Typesense collection. Kishore Nallan resolved this by suggesting to input JSON data directly, not as a file.
Apr 05, 2022 (17 months ago)
Cassandra
07:49 AMCassandra
07:50 AMCassandra
07:51 AMKishore Nallan
07:54 AMCassandra
07:56 AM"name": "books",
"fields": [
{"name": "title", "type": "string" },
{"name": "authors", "type": "string[]", "facet": true },
{"name": "publication_year", "type": "int32", "facet": true },
{"name": "ratings_count", "type": "int32" },
{"name": "average_rating", "type": "float" }
],
"default_sorting_field": "ratings_count"
}
Kishore Nallan
07:59 AMcurl -k "" -X POST -H "Content-Type: application/json" \
-H "X-TYPESENSE-API-KEY: ${TYPESENSE_API_KEY}" -d '{
"name": "books",
"fields": [
{"name": "title", "type": "string" },
{"name": "authors", "type": "string[]", "facet": true },
{"name": "publication_year", "type": "int32", "facet": true },
{"name": "ratings_count", "type": "int32" },
{"name": "average_rating", "type": "float" }
],
"default_sorting_field": "ratings_count"
}'
Kishore Nallan
08:00 AM-d collection.json
-- if you can tell me where exactly in the guide we use this format, I can also check that.Cassandra
08:02 AMKishore Nallan
08:02 AMTypesense
Indexed 2764 threads (79% resolved)
Similar Threads
Issues with Importing Typesense Collection to Different Server
Kevin had problems migrating a Typesense collection between Docusaurus sites on different machines. Jason advised them on JSONL format, handling server hosting, and creating a collection schema before importing documents, leading to successful import.



Fixing "bad json" error in Typesense 0.24
Adam experiences "bad json" error when creating collections in Typesense 0.24. Jason identifies a typo in the docs causing the error and helps troubleshoot additional errors.



Troubleshooting Typesense Connection Issue and Data Retrieval
Felix encountered issues connecting to a server-created typesense and retrieving data collections. Kishore Nallan and Jason provided guidance, highlighting errors in the original code and suggesting changes to the URL and curl command.
Sorting Results in Typesense and Handling Errors
Ramees asks about sorting results by distance in Typesense, entering a list of strings as a field, and resolving an error with `fields` format. Kishore Nallan assists with these issues and advises on storing timestamps and proper authentication.

Resolving Issues with Scoped API Keys in Typesense with Golang
Suvarna had problems with generating and using scoped API keys in Typesense with Golang. Several bugs misleading the user were found and fixed by Kishore Nallan.


