1
0
mirror of https://github.com/garraflavatra/rolens.git synced 2025-07-22 15:18:02 +00:00

Use BSON instead of JSON for unmarshalling

This commit is contained in:
2023-01-24 11:44:43 +01:00
parent fa924f087d
commit b58a2ca84f
4 changed files with 5 additions and 6 deletions

View File

@ -1,11 +1,11 @@
package app
import (
"encoding/json"
"fmt"
"strings"
"github.com/wailsapp/wails/v2/pkg/runtime"
"go.mongodb.org/mongo-driver/bson"
)
func (a *App) InsertItems(hostKey, dbKey, collKey, jsonData string) interface{} {
@ -16,7 +16,7 @@ func (a *App) InsertItems(hostKey, dbKey, collKey, jsonData string) interface{}
jsonData = "[" + jsonData + "]"
}
err := json.Unmarshal([]byte(jsonData), &data)
err := bson.UnmarshalExtJSON([]byte(jsonData), true, &data)
if err != nil {
fmt.Println(err.Error())
runtime.MessageDialog(a.ctx, runtime.MessageDialogOptions{