Fixing "bad json" error in Typesense 0.24
TLDR 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.
3
1
1
Mar 09, 2023 (9 months ago)
Adam
07:44 PMobject
as the type on a field. I’m using typesense 0.24 on docker. even when I try copying and pasting the secondcurl
example, the server errors and tells me I have “bad json”.Jason
07:46 PMAdam
07:46 PM1
Adam
07:52 PMauto
indexed field, the collection is created successfullyJason
07:53 PMJason
07:53 PM1
Jason
07:54 PMcurl -k "" -X POST -H "Content-Type: application/json" \
-H "X-TYPESENSE-API-KEY: ${TYPESENSE_API_KEY}" -d '{
"name": "docs",
"enable_nested_fields": true,
"fields": [
{"name": "person", "type": "object"},
{"name": "details", "type": "object[]"}
]
}'
Adam
07:54 PMJason
07:54 PM"object[]"},
, which is wrongAdam
07:54 PMAdam
07:56 PMts
file. I just have a habit of adding trailing commas to objects. that must be messing up the JSON object sent to the server. I’ll try removing them and see what happensJason
07:59 PMJason
08:00 PMAdam
08:00 PM1
Adam
08:01 PMAdam
08:01 PMJason
08:01 PMAdam
08:03 PMAdam
08:08 PMJason
08:09 PMAdam
08:11 PM1
Adam
10:47 PMsort
to true. I had accidentally changed the type to object
but overlooked removing the sort
property1
Typesense
Indexed 3011 threads (79% resolved)
Similar Threads
Resolving "Bad JSON" Error during Typesense Collection Creation
Cassandra had an error creating a Typesense collection. Kishore Nallan resolved this by suggesting to input JSON data directly, not as a file.
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.
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.
Typesense Server Bulk Import/Upsert Issue Resolved
Adam was confused about the discrepancy between the successful responses and the actual indexed data while working with a custom WP plugin integrating with Typesense. The issue was a bug related to fetching documents in the wrong order, not a Typesense problem.
Issue with Typesense Schema and Ruby Client
Mateo faces issues while creating a schema and using Ruby client for Typesense. Jason suggests using a new field instead of 'id' and provides assistance for Ruby client errors.