问:
How to resolve a (kotlinx.serialization.json.internal.JsonDecodingException: Expected start of the array '[', but had 'EOF' instead at path) error?
I'm trying to deserialise a JSON response from a public bus API but I have no idea what this error is suggesting. I'm using Kotlins, Android Compose, Retrofit. I suspect the entire response might be a single object in an array. However, if that is the case, there is no "name / key" for me to latch onto when de-serializing the json object.

Thank you for any comments!!

Edit: Oh dear, my mistake I forgot to include the JSON response.

JSON

```<code>{
    "odata.metadata": "http://datamall2.mytransport.sg/ltaodataservice/$metadata#BusArrivalv2/@Element",
    "BusStopCode": "65199",
    "Services": [
        {
            "ServiceNo": "109",
            "Operator": "SBST",
            "NextBus": {
                "OriginCode": "66009",
                "DestinationCode": "99009",
                "EstimatedArrival": "2022-12-23T11:08:41+08:00",
                "Latitude": "1.3971796666666667",
                "Longitude": "103.89481833333333",
                "VisitNumber": "1",
                "Load": "SEA",
                "Feature": "WAB",
                "Type": "SD"
            },
            "NextBus2": {
                "OriginCode": "66009",
                "DestinationCode": "99009",
                "EstimatedArrival": "2022-12-23T11:20:11+08:00",
                "Latitude": "1.3791336666666667",
                "Longitude": "103.88451533333334",
                "VisitNumber": "1",
                "Load": "SEA",
                "Feature": "WAB",
                "Type": "DD"
            },
            "NextBus3": {
                "OriginCode": "66009",
                "DestinationCode": "99009",
                "EstimatedArrival": "2022-12-23T11:33:39+08:00",
                "Latitude": "1.3576311666666667",
                "Longitude": "103.87389733333333",
                "VisitNumber": "1",
                "Load": "SEA",
                "Feature": "WAB",
                "Type": "SD"
            }
        },
        {
            "ServiceNo": "110",
            "Operator": "SMRT",
            "NextBus": {
                "OriginCode": "67759",
                "DestinationCode": "67759",
                "EstimatedArrival": "2022-12-23T11:15:13+08:00",
                "Latitude": "1.391956",
                "Longitude": "103.88675816666667",
                "VisitNumber": "1",
                "Load": "SEA",
                "Feature": "WAB",
                "Type": "SD"
            },
            "NextBus2": {
                "OriginCode": "",
                "DestinationCode": "",
                "EstimatedArrival": "",
                "Latitude": "",
                "Longitude": "",
                "VisitNumber": "",
                "Load": "",
                "Feature": "",
                "Type": ""
            },
            "NextBus3": {
                "OriginCode": "",
                "DestinationCode": "",
                "EstimatedArrival": "",
                "Latitude": "",
                "Longitude": "",
                "VisitNumber": "",
                "Load": "",
                "Feature": "",
                "Type": ""
            }
        },
        {
            "ServiceNo": "118",
            "Operator": "GAS",
            "NextBus": {
                "OriginCode": "65009",
                "DestinationCode": "97009",
                "EstimatedArrival": "2022-12-23T11:15:36+08:00",
                "Latitude": "0",
                "Longitude": "0",
                "VisitNumber": "1",
                "Load": "SEA",
                "Feature": "WAB",
                "Type": "DD"
            },
            "NextBus2": {
                "OriginCode": "65009",
                "DestinationCode": "97009",
                "EstimatedArrival": "2022-12-23T11:30:36+08:00",
                "Latitude": "0",
                "Longitude": "0",
                "VisitNumber": "1",
                "Load": "SEA",
                "Feature": "WAB",
                "Type": "DD"
            },
            "NextBus3": {
                "OriginCode": "65009",
                "DestinationCode": "97009",
                "EstimatedArrival": "2022-12-23T11:45:36+08:00",
                "Latitude": "0",
                "Longitude": "0",
                "VisitNumber": "1",
                "Load": "SEA",
                "Feature": "WAB",
                "Type": "DD"
            }
        },
        {
            "ServiceNo": "168",
            "Operator": "SBST",
            "NextBus": {
                "OriginCode": "46009",
                "DestinationCode": "84009",
                "EstimatedArrival": "2022-12-23T11:06:51+08:00",
                "Latitude": "1.4005116666666666",
                "Longitude": "103.89314716666667",
                "VisitNumber": "1",
                "Load": "SEA",
                "Feature": "WAB",
                "Type": "DD"
            },
            "NextBus2": {
                "OriginCode": "46009",
                "DestinationCode": "84009",
                "EstimatedArrival": "2022-12-23T11:19:20+08:00",
                "Latitude": "1.4038078333333335",
                "Longitude": "103.81116233333333",
                "VisitNumber": "1",
                "Load": "SEA",
                "Feature": "WAB",
                "Type": "DD"
            },
            "NextBus3": {
                "OriginCode": "46009",
                "DestinationCode": "84009",
                "EstimatedArrival": "2022-12-23T11:30:42+08:00",
                "Latitude": "0",
                "Longitude": "0",
                "VisitNumber": "1",
                "Load": "SEA",
                "Feature": "WAB",
                "Type": "DD"
            }
        },
        {
            "ServiceNo": "27",
            "Operator": "SBST",
            "NextBus": {
                "OriginCode": "64009",
                "DestinationCode": "64009",
                "EstimatedArrival": "2022-12-23T11:10:34+08:00",
                "Latitude": "1.3906049999999999",
                "Longitude": "103.8975745",
                "VisitNumber": "1",
                "Load": "SEA",
                "Feature": "WAB",
                "Type": "SD"
            },
            "NextBus2": {
                "OriginCode": "64009",
                "DestinationCode": "64009",
                "EstimatedArrival": "2022-12-23T11:16:14+08:00",
                "Latitude": "1.3840883333333334",
                "Longitude": "103.8931035",
                "VisitNumber": "1",
                "Load": "SEA",
                "Feature": "WAB",
                "Type": "SD"
            },
            "NextBus3": {
                "OriginCode": "64009",
                "DestinationCode": "64009",
                "EstimatedArrival": "2022-12-23T11:23:24+08:00",
                "Latitude": "1.367685",
                "Longitude": "103.89199466666666",
                "VisitNumber": "1",
                "Load": "SEA",
                "Feature": "WAB",
                "Type": "SD"
            }
        },
        {
            "ServiceNo": "3",
            "Operator": "GAS",
            "NextBus": {
                "OriginCode": "65009",
                "DestinationCode": "75009",
                "EstimatedArrival": "2022-12-23T11:09:49+08:00",
                "Latitude": "1.3943108333333334",
                "Longitude": "103.912359",
                "VisitNumber": "1",
                "Load": "SEA",
                "Feature": "WAB",
                "Type": "SD"
            },
            "NextBus2": {
                "OriginCode": "65009",
                "DestinationCode": "75009",
                "EstimatedArrival": "2022-12-23T11:17:21+08:00",
                "Latitude": "0",
                "Longitude": "0",
                "VisitNumber": "1",
                "Load": "SEA",
                "Feature": "WAB",
                "Type": "SD"
            },
            "NextBus3": {
                "OriginCode": "65009",
                "DestinationCode": "75009",
                "EstimatedArrival": "2022-12-23T11:22:41+08:00",
                "Latitude": "0",
                "Longitude": "0",
                "VisitNumber": "1",
                "Load": "SEA",
                "Feature": "WAB",
                "Type": "DD"
            }
        },
        {
            "ServiceNo": "34",
            "Operator": "GAS",
            "NextBus": {
                "OriginCode": "65009",
                "DestinationCode": "65009",
                "EstimatedArrival": "2022-12-23T11:08:02+08:00",
                "Latitude": "1.4030624999999999",
                "Longitude": "103.905756",
                "VisitNumber": "1",
                "Load": "SDA",
                "Feature": "WAB",
                "Type": "SD"
            },
            "NextBus2": {
                "OriginCode": "65009",
                "DestinationCode": "65009",
                "EstimatedArrival": "2022-12-23T11:19:00+08:00",
                "Latitude": "0",
                "Longitude": "0",
                "VisitNumber": "1",
                "Load": "SEA",
                "Feature": "WAB",
                "Type": "SD"
            },
            "NextBus3": {
                "OriginCode": "65009",
                "DestinationCode": "65009",
                "EstimatedArrival": "2022-12-23T11:34:00+08:00",
                "Latitude": "0",
                "Longitude": "0",
                "VisitNumber": "1",
                "Load": "SEA",
                "Feature": "WAB",
                "Type": "SD"
            }
        },
        {
            "ServiceNo": "858",
            "Operator": "TTS",
            "NextBus": {
                "OriginCode": "46009",
                "DestinationCode": "46009",
                "EstimatedArrival": "2022-12-23T11:07:21+08:00",
                "Latitude": "1.401444",
                "Longitude": "103.88471433333333",
                "VisitNumber": "1",
                "Load": "SEA",
                "Feature": "WAB",
                "Type": "SD"
            },
            "NextBus2": {
                "OriginCode": "46009",
                "DestinationCode": "46009",
                "EstimatedArrival": "2022-12-23T11:15:18+08:00",
                "Latitude": "1.396672",
                "Longitude": "103.843551",
                "VisitNumber": "1",
                "Load": "SEA",
                "Feature": "WAB",
                "Type": "BD"
            },
            "NextBus3": {
                "OriginCode": "46009",
                "DestinationCode": "46009",
                "EstimatedArrival": "2022-12-23T11:32:28+08:00",
                "Latitude": "1.4304945",
                "Longitude": "103.8332425",
                "VisitNumber": "1",
                "Load": "SEA",
                "Feature": "WAB",
                "Type": "SD"
            }
        },
        {
            "ServiceNo": "88",
            "Operator": "SBST",
            "NextBus": {
                "OriginCode": "52009",
                "DestinationCode": "77009",
                "EstimatedArrival": "2022-12-23T11:11:26+08:00",
                "Latitude": "1.3829096666666667",
                "Longitude": "103.89827683333333",
                "VisitNumber": "1",
                "Load": "SEA",
                "Feature": "WAB",
                "Type": "DD"
            },
            "NextBus2": {
                "OriginCode": "52009",
                "DestinationCode": "77009",
                "EstimatedArrival": "2022-12-23T11:16:18+08:00",
                "Latitude": "1.3768328333333333",
                "Longitude": "103.89260733333333",
                "VisitNumber": "1",
                "Load": "SEA",
                "Feature": "WAB",
                "Type": "DD"
            },
            "NextBus3": {
                "OriginCode": "52009",
                "DestinationCode": "77009",
                "EstimatedArrival": "2022-12-23T11:17:23+08:00",
                "Latitude": "1.3757058333333334",
                "Longitude": "103.889185",
                "VisitNumber": "1",
                "Load": "SEA",
                "Feature": "WAB",
                "Type": "DD"
            }
        },
        {
            "ServiceNo": "89",
            "Operator": "SBST",
            "NextBus": {
                "OriginCode": "64009",
                "DestinationCode": "64009",
                "EstimatedArrival": "2022-12-23T11:12:25+08:00",
                "Latitude": "1.3876896666666667",
                "Longitude": "103.89635566666666",
                "VisitNumber": "1",
                "Load": "SEA",
                "Feature": "WAB",
                "Type": "DD"
            },
            "NextBus2": {
                "OriginCode": "64009",
                "DestinationCode": "64009",
                "EstimatedArrival": "2022-12-23T11:24:59+08:00",
                "Latitude": "0",
                "Longitude": "0",
                "VisitNumber": "1",
                "Load": "SEA",
                "Feature": "WAB",
                "Type": "DD"
            },
            "NextBus3": {
                "OriginCode": "64009",
                "DestinationCode": "64009",
                "EstimatedArrival": "2022-12-23T11:34:18+08:00",
                "Latitude": "0",
                "Longitude": "0",
                "VisitNumber": "1",
                "Load": "SEA",
                "Feature": "WAB",
                "Type": "DD"
            }
        },
        {
            "ServiceNo": "969",
            "Operator": "TTS",
            "NextBus": {
                "OriginCode": "46009",
                "DestinationCode": "75009",
                "EstimatedArrival": "2022-12-23T11:07:27+08:00",
                "Latitude": "1.4008453333333333",
                "Longitude": "103.89069783333333",
                "VisitNumber": "1",
                "Load": "SEA",
                "Feature": "WAB",
                "Type": "DD"
            },
            "NextBus2": {
                "OriginCode": "46009",
                "DestinationCode": "75009",
                "EstimatedArrival": "2022-12-23T11:20:13+08:00",
                "Latitude": "1.4184465",
                "Longitude": "103.8339825",
                "VisitNumber": "1",
                "Load": "SEA",
                "Feature": "WAB",
                "Type": "DD"
            },
            "NextBus3": {
                "OriginCode": "46009",
                "DestinationCode": "75009",
                "EstimatedArrival": "2022-12-23T11:27:14+08:00",
                "Latitude": "1.4303995",
                "Longitude": "103.83537966666667",
                "VisitNumber": "1",
                "Load": "SEA",
                "Feature": "WAB",
                "Type": "DD"
            }
        }
    ]
}
</code>```

This is the full error:

```<code>Process: com.example.busexpress, PID: 20786
kotlinx.serialization.json.internal.JsonDecodingException: Expected start of the array '[', but had 'EOF' instead at path: $

JSON input: .....isitNumber":"1","Load":"SEA","Feature":"WAB","Type":"DD"}}]}

at kotlinx.serialization.json.internal.JsonExceptionsKt.JsonDecodingException(JsonExceptions.kt:24)

at kotlinx.serialization.json.internal.JsonExceptionsKt.JsonDecodingException(JsonExceptions.kt:32)

at kotlinx.serialization.json.internal.AbstractJsonLexer.fail(AbstractJsonLexer.kt:530)

at kotlinx.serialization.json.internal.AbstractJsonLexer.fail$default(AbstractJsonLexer.kt:528)

at kotlinx.serialization.json.internal.AbstractJsonLexer.fail$kotlinx_serialization_json(AbstractJsonLexer.kt:224)

at kotlinx.serialization.json.internal.AbstractJsonLexer.unexpectedToken(AbstractJsonLexer.kt:207)

at kotlinx.serialization.json.internal.StringJsonLexer.consumeNextToken(StringJsonLexer.kt:74)

at kotlinx.serialization.json.internal.StreamingJsonDecoder.beginStructure(StreamingJsonDecoder.kt:97)

at kotlinx.serialization.internal.AbstractCollectionSerializer.merge(CollectionSerializers.kt:29)

at kotlinx.serialization.internal.AbstractCollectionSerializer.deserialize(CollectionSerializers.kt:43)

at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeSerializableValue(StreamingJsonDecoder.kt:70)

at kotlinx.serialization.json.Json.decodeFromString(Json.kt:95)

at com.jakewharton.retrofit2.converter.kotlinx.serialization.Serializer$FromString.fromResponseBody(Serializer.kt:30)

at com.jakewharton.retrofit2.converter.kotlinx.serialization.DeserializationStrategyConverter.convert(DeserializationStrategyConverter.kt:11)

at com.jakewharton.retrofit2.converter.kotlinx.serialization.DeserializationStrategyConverter.convert(DeserializationStrategyConverter.kt:7)

at retrofit2.OkHttpCall.parseResponse(OkHttpCall.java:243)

at retrofit2.OkHttpCall$1.onResponse(OkHttpCall.java:153)

at okhttp3.internal.connection.RealCall$AsyncCall.run(RealCall.kt:504)

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1137)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:637)

at java.lang.Thread.run(Thread.java:1012)

Suppressed: kotlinx.coroutines.DiagnosticCoroutineContextException: [StandaloneCoroutine{Cancelling}@4c47cf1, Dispatchers.Main.immediate]
</code>```

This is my Data Class to hold the JSON Response.

```<code>package com.example.busexpress.network

import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

@Serializable
data class SingaporeBus(
    @SerialName(value = "odata.metadata")
    val metaData: String,

    @SerialName(value = "BusStopCode")
    val busStopCode: String,

    @SerialName(value = "Services")
    val services: List<SingaporeBusServices>,
)

@Serializable
data class SingaporeBusServices(
    @SerialName(value = "ServiceNo")
    val busServiceNumber: String,

    @SerialName(value = "Operator")
    val busOperator: String,

    // Bus Arrival Timings
    @SerialName(value = "NextBus")
    val nextBus1: NextBusTiming,

    @SerialName(value = "NextBus2")
    val nextBus2: NextBusTiming,

    @SerialName(value = "NextBus3")
    val nextBus3: NextBusTiming
)

@Serializable
data class NextBusTiming(
    // Date-Time expressed in the UTC standard, GMT+8 for Singapore Standard Time (SST)
    @SerialName(value = "OriginCode")
    val startingBusStop: String,

    @SerialName(value = "DestinationCode")
    val endingBusStop: String,

    @SerialName(value = "EstimatedArrival")
    val estimatedArrival: String,

    // Bus Approximate Location
    @SerialName(value = "Latitude")
    val latitude: String,

    @SerialName(value = "Longitude")
    val longitude: String,

    @SerialName(value = "VisitNumber")
    val visitNumber: String,

    // Current Bus Occupancy Levels
    @SerialName(value = "Load")
    val busOccupancyLevels: String,

    // Wheelchair Support
    @SerialName(value = "Feature")
    val wheelchairAccessible: String,

    // Bus Type
    @SerialName(value = "Type")
    val vehicleType: String,
)
</code>```

Body:
I'm trying to deserialise a JSON response from a public bus API but I have no idea what this error is suggesting. I'm using Kotlins, Android Compose, Retrofit. I suspect the entire response might be a single object in an array. However, if that is the case, there is no "name / key" for me to latch onto when de-serializing the json object.

Thank you for any comments!!

Edit: Oh dear, my mistake I forgot to include the JSON response.

JSON

{
    "odata.metadata": "http://datamall2.mytransport.sg/ltaodataservice/$metadata#BusArrivalv2/@Element",
    "BusStopCode": "65199",
    "Services": [
        {
            "ServiceNo": "109",
            "Operator": "SBST",
            "NextBus": {
                "OriginCode": "66009",
                "DestinationCode": "99009",
                "EstimatedArrival": "2022-12-23T11:08:41+08:00",
                "Latitude": "1.3971796666666667",
                "Longitude": "103.89481833333333",
                "VisitNumber": "1",
                "Load": "SEA",
                "Feature": "WAB",
                "Type": "SD"
            },
            "NextBus2": {
                "OriginCode": "66009",
                "DestinationCode": "99009",
                "EstimatedArrival": "2022-12-23T11:20:11+08:00",
                "Latitude": "1.3791336666666667",
                "Longitude": "103.88451533333334",
                "VisitNumber": "1",
                "Load": "SEA",
                "Feature": "WAB",
                "Type": "DD"
            },
            "NextBus3": {
                "OriginCode": "66009",
                "DestinationCode": "99009",
                "EstimatedArrival": "2022-12-23T11:33:39+08:00",
                "Latitude": "1.3576311666666667",
                "Longitude": "103.87389733333333",
                "VisitNumber": "1",
                "Load": "SEA",
                "Feature": "WAB",
                "Type": "SD"
            }
        },
        {
            "ServiceNo": "110",
            "Operator": "SMRT",
            "NextBus": {
                "OriginCode": "67759",
                "DestinationCode": "67759",
                "EstimatedArrival": "2022-12-23T11:15:13+08:00",
                "Latitude": "1.391956",
                "Longitude": "103.88675816666667",
                "VisitNumber": "1",
                "Load": "SEA",
                "Feature": "WAB",
                "Type": "SD"
            },
            "NextBus2": {
                "OriginCode": "",
                "DestinationCode": "",
                "EstimatedArrival": "",
                "Latitude": "",
                "Longitude": "",
                "VisitNumber": "",
                "Load": "",
                "Feature": "",
                "Type": ""
            },
            "NextBus3": {
                "OriginCode": "",
                "DestinationCode": "",
                "EstimatedArrival": "",
                "Latitude": "",
                "Longitude": "",
                "VisitNumber": "",
                "Load": "",
                "Feature": "",
                "Type": ""
            }
        },
        {
            "ServiceNo": "118",
            "Operator": "GAS",
            "NextBus": {
                "OriginCode": "65009",
                "DestinationCode": "97009",
                "EstimatedArrival": "2022-12-23T11:15:36+08:00",
                "Latitude": "0",
                "Longitude": "0",
                "VisitNumber": "1",
                "Load": "SEA",
                "Feature": "WAB",
                "Type": "DD"
            },
            "NextBus2": {
                "OriginCode": "65009",
                "DestinationCode": "97009",
                "EstimatedArrival": "2022-12-23T11:30:36+08:00",
                "Latitude": "0",
                "Longitude": "0",
                "VisitNumber": "1",
                "Load": "SEA",
                "Feature": "WAB",
                "Type": "DD"
            },
            "NextBus3": {
                "OriginCode": "65009",
                "DestinationCode": "97009",
                "EstimatedArrival": "2022-12-23T11:45:36+08:00",
                "Latitude": "0",
                "Longitude": "0",
                "VisitNumber": "1",
                "Load": "SEA",
                "Feature": "WAB",
                "Type": "DD"
            }
        },
        {
            "ServiceNo": "168",
            "Operator": "SBST",
            "NextBus": {
                "OriginCode": "46009",
                "DestinationCode": "84009",
                "EstimatedArrival": "2022-12-23T11:06:51+08:00",
                "Latitude": "1.4005116666666666",
                "Longitude": "103.89314716666667",
                "VisitNumber": "1",
                "Load": "SEA",
                "Feature": "WAB",
                "Type": "DD"
            },
            "NextBus2": {
                "OriginCode": "46009",
                "DestinationCode": "84009",
                "EstimatedArrival": "2022-12-23T11:19:20+08:00",
                "Latitude": "1.4038078333333335",
                "Longitude": "103.81116233333333",
                "VisitNumber": "1",
                "Load": "SEA",
                "Feature": "WAB",
                "Type": "DD"
            },
            "NextBus3": {
                "OriginCode": "46009",
                "DestinationCode": "84009",
                "EstimatedArrival": "2022-12-23T11:30:42+08:00",
                "Latitude": "0",
                "Longitude": "0",
                "VisitNumber": "1",
                "Load": "SEA",
                "Feature": "WAB",
                "Type": "DD"
            }
        },
        {
            "ServiceNo": "27",
            "Operator": "SBST",
            "NextBus": {
                "OriginCode": "64009",
                "DestinationCode": "64009",
                "EstimatedArrival": "2022-12-23T11:10:34+08:00",
                "Latitude": "1.3906049999999999",
                "Longitude": "103.8975745",
                "VisitNumber": "1",
                "Load": "SEA",
                "Feature": "WAB",
                "Type": "SD"
            },
            "NextBus2": {
                "OriginCode": "64009",
                "DestinationCode": "64009",
                "EstimatedArrival": "2022-12-23T11:16:14+08:00",
                "Latitude": "1.3840883333333334",
                "Longitude": "103.8931035",
                "VisitNumber": "1",
                "Load": "SEA",
                "Feature": "WAB",
                "Type": "SD"
            },
            "NextBus3": {
                "OriginCode": "64009",
                "DestinationCode": "64009",
                "EstimatedArrival": "2022-12-23T11:23:24+08:00",
                "Latitude": "1.367685",
                "Longitude": "103.89199466666666",
                "VisitNumber": "1",
                "Load": "SEA",
                "Feature": "WAB",
                "Type": "SD"
            }
        },
        {
            "ServiceNo": "3",
            "Operator": "GAS",
            "NextBus": {
                "OriginCode": "65009",
                "DestinationCode": "75009",
                "EstimatedArrival": "2022-12-23T11:09:49+08:00",
                "Latitude": "1.3943108333333334",
                "Longitude": "103.912359",
                "VisitNumber": "1",
                "Load": "SEA",
                "Feature": "WAB",
                "Type": "SD"
            },
            "NextBus2": {
                "OriginCode": "65009",
                "DestinationCode": "75009",
                "EstimatedArrival": "2022-12-23T11:17:21+08:00",
                "Latitude": "0",
                "Longitude": "0",
                "VisitNumber": "1",
                "Load": "SEA",
                "Feature": "WAB",
                "Type": "SD"
            },
            "NextBus3": {
                "OriginCode": "65009",
                "DestinationCode": "75009",
                "EstimatedArrival": "2022-12-23T11:22:41+08:00",
                "Latitude": "0",
                "Longitude": "0",
                "VisitNumber": "1",
                "Load": "SEA",
                "Feature": "WAB",
                "Type": "DD"
            }
        },
        {
            "ServiceNo": "34",
            "Operator": "GAS",
            "NextBus": {
                "OriginCode": "65009",
                "DestinationCode": "65009",
                "EstimatedArrival": "2022-12-23T11:08:02+08:00",
                "Latitude": "1.4030624999999999",
                "Longitude": "103.905756",
                "VisitNumber": "1",
                "Load": "SDA",
                "Feature": "WAB",
                "Type": "SD"
            },
            "NextBus2": {
                "OriginCode": "65009",
                "DestinationCode": "65009",
                "EstimatedArrival": "2022-12-23T11:19:00+08:00",
                "Latitude": "0",
                "Longitude": "0",
                "VisitNumber": "1",
                "Load": "SEA",
                "Feature": "WAB",
                "Type": "SD"
            },
            "NextBus3": {
                "OriginCode": "65009",
                "DestinationCode": "65009",
                "EstimatedArrival": "2022-12-23T11:34:00+08:00",
                "Latitude": "0",
                "Longitude": "0",
                "VisitNumber": "1",
                "Load": "SEA",
                "Feature": "WAB",
                "Type": "SD"
            }
        },
        {
            "ServiceNo": "858",
            "Operator": "TTS",
            "NextBus": {
                "OriginCode": "46009",
                "DestinationCode": "46009",
                "EstimatedArrival": "2022-12-23T11:07:21+08:00",
                "Latitude": "1.401444",
                "Longitude": "103.88471433333333",
                "VisitNumber": "1",
                "Load": "SEA",
                "Feature": "WAB",
                "Type": "SD"
            },
            "NextBus2": {
                "OriginCode": "46009",
                "DestinationCode": "46009",
                "EstimatedArrival": "2022-12-23T11:15:18+08:00",
                "Latitude": "1.396672",
                "Longitude": "103.843551",
                "VisitNumber": "1",
                "Load": "SEA",
                "Feature": "WAB",
                "Type": "BD"
            },
            "NextBus3": {
                "OriginCode": "46009",
                "DestinationCode": "46009",
                "EstimatedArrival": "2022-12-23T11:32:28+08:00",
                "Latitude": "1.4304945",
                "Longitude": "103.8332425",
                "VisitNumber": "1",
                "Load": "SEA",
                "Feature": "WAB",
                "Type": "SD"
            }
        },
        {
            "ServiceNo": "88",
            "Operator": "SBST",
            "NextBus": {
                "OriginCode": "52009",
                "DestinationCode": "77009",
                "EstimatedArrival": "2022-12-23T11:11:26+08:00",
                "Latitude": "1.3829096666666667",
                "Longitude": "103.89827683333333",
                "VisitNumber": "1",
                "Load": "SEA",
                "Feature": "WAB",
                "Type": "DD"
            },
            "NextBus2": {
                "OriginCode": "52009",
                "DestinationCode": "77009",
                "EstimatedArrival": "2022-12-23T11:16:18+08:00",
                "Latitude": "1.3768328333333333",
                "Longitude": "103.89260733333333",
                "VisitNumber": "1",
                "Load": "SEA",
                "Feature": "WAB",
                "Type": "DD"
            },
            "NextBus3": {
                "OriginCode": "52009",
                "DestinationCode": "77009",
                "EstimatedArrival": "2022-12-23T11:17:23+08:00",
                "Latitude": "1.3757058333333334",
                "Longitude": "103.889185",
                "VisitNumber": "1",
                "Load": "SEA",
                "Feature": "WAB",
                "Type": "DD"
            }
        },
        {
            "ServiceNo": "89",
            "Operator": "SBST",
            "NextBus": {
                "OriginCode": "64009",
                "DestinationCode": "64009",
                "EstimatedArrival": "2022-12-23T11:12:25+08:00",
                "Latitude": "1.3876896666666667",
                "Longitude": "103.89635566666666",
                "VisitNumber": "1",
                "Load": "SEA",
                "Feature": "WAB",
                "Type": "DD"
            },
            "NextBus2": {
                "OriginCode": "64009",
                "DestinationCode": "64009",
                "EstimatedArrival": "2022-12-23T11:24:59+08:00",
                "Latitude": "0",
                "Longitude": "0",
                "VisitNumber": "1",
                "Load": "SEA",
                "Feature": "WAB",
                "Type": "DD"
            },
            "NextBus3": {
                "OriginCode": "64009",
                "DestinationCode": "64009",
                "EstimatedArrival": "2022-12-23T11:34:18+08:00",
                "Latitude": "0",
                "Longitude": "0",
                "VisitNumber": "1",
                "Load": "SEA",
                "Feature": "WAB",
                "Type": "DD"
            }
        },
        {
            "ServiceNo": "969",
            "Operator": "TTS",
            "NextBus": {
                "OriginCode": "46009",
                "DestinationCode": "75009",
                "EstimatedArrival": "2022-12-23T11:07:27+08:00",
                "Latitude": "1.4008453333333333",
                "Longitude": "103.89069783333333",
                "VisitNumber": "1",
                "Load": "SEA",
                "Feature": "WAB",
                "Type": "DD"
            },
            "NextBus2": {
                "OriginCode": "46009",
                "DestinationCode": "75009",
                "EstimatedArrival": "2022-12-23T11:20:13+08:00",
                "Latitude": "1.4184465",
                "Longitude": "103.8339825",
                "VisitNumber": "1",
                "Load": "SEA",
                "Feature": "WAB",
                "Type": "DD"
            },
            "NextBus3": {
                "OriginCode": "46009",
                "DestinationCode": "75009",
                "EstimatedArrival": "2022-12-23T11:27:14+08:00",
                "Latitude": "1.4303995",
                "Longitude": "103.83537966666667",
                "VisitNumber": "1",
                "Load": "SEA",
                "Feature": "WAB",
                "Type": "DD"
            }
        }
    ]
}

This is the full error:

Process: com.example.busexpress, PID: 20786
kotlinx.serialization.json.internal.JsonDecodingException: Expected start of the array '[', but had 'EOF' instead at path: $

JSON input: .....isitNumber":"1","Load":"SEA","Feature":"WAB","Type":"DD"}}]}

at kotlinx.serialization.json.internal.JsonExceptionsKt.JsonDecodingException(JsonExceptions.kt:24)

at kotlinx.serialization.json.internal.JsonExceptionsKt.JsonDecodingException(JsonExceptions.kt:32)

at kotlinx.serialization.json.internal.AbstractJsonLexer.fail(AbstractJsonLexer.kt:530)

at kotlinx.serialization.json.internal.AbstractJsonLexer.fail$default(AbstractJsonLexer.kt:528)

at kotlinx.serialization.json.internal.AbstractJsonLexer.fail$kotlinx_serialization_json(AbstractJsonLexer.kt:224)

at kotlinx.serialization.json.internal.AbstractJsonLexer.unexpectedToken(AbstractJsonLexer.kt:207)

at kotlinx.serialization.json.internal.StringJsonLexer.consumeNextToken(StringJsonLexer.kt:74)

at kotlinx.serialization.json.internal.StreamingJsonDecoder.beginStructure(StreamingJsonDecoder.kt:97)

at kotlinx.serialization.internal.AbstractCollectionSerializer.merge(CollectionSerializers.kt:29)

at kotlinx.serialization.internal.AbstractCollectionSerializer.deserialize(CollectionSerializers.kt:43)

at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeSerializableValue(StreamingJsonDecoder.kt:70)

at kotlinx.serialization.json.Json.decodeFromString(Json.kt:95)

at com.jakewharton.retrofit2.converter.kotlinx.serialization.Serializer$FromString.fromResponseBody(Serializer.kt:30)

at com.jakewharton.retrofit2.converter.kotlinx.serialization.DeserializationStrategyConverter.convert(DeserializationStrategyConverter.kt:11)

at com.jakewharton.retrofit2.converter.kotlinx.serialization.DeserializationStrategyConverter.convert(DeserializationStrategyConverter.kt:7)

at retrofit2.OkHttpCall.parseResponse(OkHttpCall.java:243)

at retrofit2.OkHttpCall$1.onResponse(OkHttpCall.java:153)

at okhttp3.internal.connection.RealCall$AsyncCall.run(RealCall.kt:504)

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1137)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:637)

at java.lang.Thread.run(Thread.java:1012)

Suppressed: kotlinx.coroutines.DiagnosticCoroutineContextException: [StandaloneCoroutine{Cancelling}@4c47cf1, Dispatchers.Main.immediate]

This is my Data Class to hold the JSON Response.

package com.example.busexpress.network

import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

@Serializable
data class SingaporeBus(
    @SerialName(value = "odata.metadata")
    val metaData: String,

    @SerialName(value = "BusStopCode")
    val busStopCode: String,

    @SerialName(value = "Services")
    val services: List<SingaporeBusServices>,
)

@Serializable
data class SingaporeBusServices(
    @SerialName(value = "ServiceNo")
    val busServiceNumber: String,

    @SerialName(value = "Operator")
    val busOperator: String,

    // Bus Arrival Timings
    @SerialName(value = "NextBus")
    val nextBus1: NextBusTiming,

    @SerialName(value = "NextBus2")
    val nextBus2: NextBusTiming,

    @SerialName(value = "NextBus3")
    val nextBus3: NextBusTiming
)

@Serializable
data class NextBusTiming(
    // Date-Time expressed in the UTC standard, GMT+8 for Singapore Standard Time (SST)
    @SerialName(value = "OriginCode")
    val startingBusStop: String,

    @SerialName(value = "DestinationCode")
    val endingBusStop: String,

    @SerialName(value = "EstimatedArrival")
    val estimatedArrival: String,

    // Bus Approximate Location
    @SerialName(value = "Latitude")
    val latitude: String,

    @SerialName(value = "Longitude")
    val longitude: String,

    @SerialName(value = "VisitNumber")
    val visitNumber: String,

    // Current Bus Occupancy Levels
    @SerialName(value = "Load")
    val busOccupancyLevels: String,

    // Wheelchair Support
    @SerialName(value = "Feature")
    val wheelchairAccessible: String,

    // Bus Type
    @SerialName(value = "Type")
    val vehicleType: String,
)


来源: stackexchange

问:
System.InvalidOperationException: 'You must call Xamarin.Forms.Forms.Init(); prior to using this property.'
I created a new UWP app, something I've never done before, and copy and pasted a bunch of code from another Xamarin Forms project, code that did work there. Now I run into the error:

```<code>System.InvalidOperationException: 'You must call Xamarin.Forms.Forms.Init(); prior to using this property.
</code>```

"this property" being a chuck of code meant to create a "refresh rate" so that I can create movement of SkiaSharp graphics:                                       (if theres a better way to do this please let me know)

```<code>Device.StartTimer(TimeSpan.FromMilliseconds(1), () =>
            {
                canvasView.Invalidate();
                return true;
            });
</code>```

I don't necessarily just want the code to make this work but I genuinely would like to understand what's happening. I can't just insert Forms.Init(); into my code because that requires parameters, but I don't know what parameters to feed into it. I don't necessarily just want the code to make this work but I genuinely would like to understand what's happening. Any help is appreciated.

My code:

using RPS_Sim;
using RPS_Sim.Objects;
using SkiaSharp;
using SkiaSharp.Views.UWP;
using System;
using System.Collections.Generic;
using Xamarin.Forms;

namespace RPS_Sim
{
    //Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"
    public partial class MainPage
    {

        int speed = 1, size = 50;
        PosMov posMov;
        Rock rock;
        Paper paper;
        Scissors scissor;
        List<Object> Objects;

        int w, h;
        public MainPage()
        {
            DependencyService.Register<MainPage>();
            InitializeComponent();

            Device.StartTimer(TimeSpan.FromMilliseconds(1), () =>
            {
                canvasView.Invalidate();
                return true;
            });

            posMov = new PosMov(0, 0, speed, size);

            rock = new Rock(posMov.x, posMov.y, posMov.speed, posMov.size);
            paper = new Paper(posMov.x, posMov.y, posMov.speed, posMov.size);
            scissor = new Scissors(posMov.x, posMov.y, posMov.speed, posMov.size);

            Objects = new List<Object>();

            Objects.Add(rock);
            Objects.Add(paper);
            Objects.Add(scissor);

            foreach (var O in Objects)
            {
                O.Randomize(1);
            }
        }
        private void canvasView_PaintSurface(object sender, SKPaintSurfaceEventArgs e)//, MouseButtonEventArgs mouse)            //put all realtime events here
        {

            SKSurface surface = e.Surface;
            SKCanvas canvas = surface.Canvas;
            canvas.Clear(SKColors.White);
            w = e.Info.Width / 2;
            h = e.Info.Height / 2;
            canvas.Translate(w, h);

            /*foreach (var O in Objects)
            {
                O.Update(canvas, w, h);
            }*/

            rock.Update(canvas, w, h);
            paper.Update(canvas, w, h);
            scissor.Update(canvas, w, h);
        }

    }
}
```

ContentLicense: CC BY-SA 4.0

Body:
I created a new UWP app, something I've never done before, and copy and pasted a bunch of code from another Xamarin Forms project, code that did work there. Now I run into the error:

System.InvalidOperationException: 'You must call Xamarin.Forms.Forms.Init(); prior to using this property.

"this property" being a chuck of code meant to create a "refresh rate" so that I can create movement of SkiaSharp graphics:                                       (if theres a better way to do this please let me know)

Device.StartTimer(TimeSpan.FromMilliseconds(1), () =>
            {
                canvasView.Invalidate();
                return true;
            });

I don't necessarily just want the code to make this work but I genuinely would like to understand what's happening. I can't just insert Forms.Init(); into my code because that requires parameters, but I don't know what parameters to feed into it. I don't necessarily just want the code to make this work but I genuinely would like to understand what's happening. Any help is appreciated.

My code:

using RPS_Sim;
using RPS_Sim.Objects;
using SkiaSharp;
using SkiaSharp.Views.UWP;
using System;
using System.Collections.Generic;
using Xamarin.Forms;

namespace RPS_Sim
{
    //Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"
    public partial class MainPage
    {

        int speed = 1, size = 50;
        PosMov posMov;
        Rock rock;
        Paper paper;
        Scissors scissor;
        List<Object> Objects;

        int w, h;
        public MainPage()
        {
            DependencyService.Register<MainPage>();
            InitializeComponent();

            Device.StartTimer(TimeSpan.FromMilliseconds(1), () =>
            {
                canvasView.Invalidate();
                return true;
            });

            posMov = new PosMov(0, 0, speed, size);

            rock = new Rock(posMov.x, posMov.y, posMov.speed, posMov.size);
            paper = new Paper(posMov.x, posMov.y, posMov.speed, posMov.size);
            scissor = new Scissors(posMov.x, posMov.y, posMov.speed, posMov.size);

            Objects = new List<Object>();

            Objects.Add(rock);
            Objects.Add(paper);
            Objects.Add(scissor);

            foreach (var O in Objects)
            {
                O.Randomize(1);
            }
        }
        private void canvasView_PaintSurface(object sender, SKPaintSurfaceEventArgs e)//, MouseButtonEventArgs mouse)            //put all realtime events here
        {

            SKSurface surface = e.Surface;
            SKCanvas canvas = surface.Canvas;
            canvas.Clear(SKColors.White);
            w = e.Info.Width / 2;
            h = e.Info.Height / 2;
            canvas.Translate(w, h);

            /*foreach (var O in Objects)
            {
                O.Update(canvas, w, h);
            }*/

            rock.Update(canvas, w, h);
            paper.Update(canvas, w, h);
            scissor.Update(canvas, w, h);
        }

    }
}


问:
Logging in to Flask-Login Webpage using Python Request
I want to use python request to log in a webpage created by flask-login. Here is my code using request:

```<code>session = requests.Session()
session.auth = ('test@test.com',
 'test')
 auth = session.post(login_url)
 response = session.get(login_url)
</code>```

Regardless of what I enter as email address and password, I always get 200 code. Seems like authentication does not go through at all. Here is the inspect header. I could not find any email/password field in there:

```<code>Request URL: http://webaddress/login
Request Method: GET
Status Code: 200 OK
Remote Address: IP address:80
Referrer Policy: strict-origin-when-
cross-origin
Connection: keep-alive
Content-Encoding: gzip
Content-Type: text/html; charset=utf-8
Date: Fri, 23 Dec 2022 03:13:44 GMT
Server: nginx/1.18.0
Transfer-Encoding: chunked
Vary: Cookie
</code>```

Any ideas what I am missing here?

Body:
I want to use python request to log in a webpage created by flask-login. Here is my code using request:

session = requests.Session()
session.auth = ('test@test.com',
 'test')
 auth = session.post(login_url)
 response = session.get(login_url)

Regardless of what I enter as email address and password, I always get 200 code. Seems like authentication does not go through at all. Here is the inspect header. I could not find any email/password field in there:

Request URL: http://webaddress/login
Request Method: GET
Status Code: 200 OK
Remote Address: IP address:80
Referrer Policy: strict-origin-when-
cross-origin
Connection: keep-alive
Content-Encoding: gzip
Content-Type: text/html; charset=utf-8
Date: Fri, 23 Dec 2022 03:13:44 GMT
Server: nginx/1.18.0
Transfer-Encoding: chunked
Vary: Cookie

Any ideas what I am missing here?


问:
How can I make folder tree use Treeview?
I'm trying to create my own custom folder tree model using QStandardItemModel. I succeeded in making it using TreeWidget, but the correct address was not printed, so I used the QStandardItemModel where the index is stored.
However, I'm leaving a question because I'm stuck in many ways and I want to get some advice on this.

```<code>void QtWidgetsApplication1::AddDocTree(QStandardItem *DocItem, QString Path)
{
    QString path = QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation);
    QDir* rootDir = new QDir(path);
    QFileInfoList filesList = rootDir->entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot);
    DocItem = TestModel->invisibleRootItem();
    foreach(QFileInfo fileInfo, filesList)
    {
        if (fileInfo.isFile())
        {
            QIcon BasicIcon = mpIconProvider->icon(fileInfo);
            child = new  QStandardItem(BasicIcon, fileInfo.fileName());
            child->setAccessibleDescription(fileInfo.filePath());
        }
        else
        {
            QIcon BasicIcon = mpIconProvider->icon(fileInfo);
            child = new  QStandardItem(BasicIcon, fileInfo.fileName());
            child->setAccessibleDescription(fileInfo.filePath());
        }
        DocItem->appendRow(child);
        AddDocTree(child, fileInfo.filePath());
        DocItem = child;
    }
}
</code>```

I have a drive model that we've already created using the QFilesystemModel, but ultimately we have to create a folder tree that looks like a Windows File Explorer.

Body:
I'm trying to create my own custom folder tree model using QStandardItemModel. I succeeded in making it using TreeWidget, but the correct address was not printed, so I used the QStandardItemModel where the index is stored.
However, I'm leaving a question because I'm stuck in many ways and I want to get some advice on this.

void QtWidgetsApplication1::AddDocTree(QStandardItem *DocItem, QString Path)
{
    QString path = QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation);
    QDir* rootDir = new QDir(path);
    QFileInfoList filesList = rootDir->entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot);
    DocItem = TestModel->invisibleRootItem();
    foreach(QFileInfo fileInfo, filesList)
    {
        if (fileInfo.isFile())
        {
            QIcon BasicIcon = mpIconProvider->icon(fileInfo);
            child = new  QStandardItem(BasicIcon, fileInfo.fileName());
            child->setAccessibleDescription(fileInfo.filePath());
        }
        else
        {
            QIcon BasicIcon = mpIconProvider->icon(fileInfo);
            child = new  QStandardItem(BasicIcon, fileInfo.fileName());
            child->setAccessibleDescription(fileInfo.filePath());
        }
        DocItem->appendRow(child);
        AddDocTree(child, fileInfo.filePath());
        DocItem = child;
    }
}

I have a drive model that we've already created using the QFilesystemModel, but ultimately we have to create a folder tree that looks like a Windows File Explorer.


问:
how to calculate polynom coefficient at compile time?
I need to calculate the initial guess for the newtons method at compile-time. I'd like to prevent this calculation from happening at runtime.

Usually, I'd solve this problem using the enum trick:

```<code>enum
{
  a = make_coeff(...),
  b = make_coeff(...),
  c = make_coeff(...)
};
</code>```

where a, b, c are coefficients and make_coeff() is a consteval/constexpr function. I can't use this approach this time, because the coefficients are of class type.

I have tried:

```<code>static constexpr coeff_type a[]{make_coeff(...), make_coeff(...), make_coeff(...)};
</code>```

Would such an array of coefficients guarantee that make_coeff() will not be executed at runtime? Even though make_coeff() is marked consteval, gcc will happily generate code for it. But clang will not allow even a static constexpr array.

the errors clang gives are:

```<code>error: static variable not permitted in a constexpr function
error: cannot take address of consteval function 'make_coeff' outside of an immediate invocation
</code>```

gcc is happy, but I am suspicious of what it is actually doing.

another thing I was thinking about is:

```<code>template <auto C>
constexpr auto coeff() noexcept
{
  return C;
}

coeff<make_coeff(...)>();
</code>```

since I can pass a coefficient as a non-type template parameter.

is a template array possible?

```<code>template <auto ...C>
decltype((C, ...)) const a[]{C...};
</code>```

perhaps even something like:

```<code>template <std::size_t I, auto ...C>
auto get() noexcept
{
  // ... easy to implement, but I'm not sure if it is worthwhile
}
</code>```

Body:
I need to calculate the initial guess for the newtons method at compile-time. I'd like to prevent this calculation from happening at runtime.

Usually, I'd solve this problem using the enum trick:

enum
{
  a = make_coeff(...),
  b = make_coeff(...),
  c = make_coeff(...)
};

where a, b, c are coefficients and make_coeff() is a consteval/constexpr function. I can't use this approach this time, because the coefficients are of class type.

I have tried:

static constexpr coeff_type a[]{make_coeff(...), make_coeff(...), make_coeff(...)};

Would such an array of coefficients guarantee that make_coeff() will not be executed at runtime? Even though make_coeff() is marked consteval, gcc will happily generate code for it. But clang will not allow even a static constexpr array.

the errors clang gives are:

error: static variable not permitted in a constexpr function
error: cannot take address of consteval function 'make_coeff' outside of an immediate invocation

gcc is happy, but I am suspicious of what it is actually doing.

another thing I was thinking about is:

template <auto C>
constexpr auto coeff() noexcept
{
  return C;
}

coeff<make_coeff(...)>();

since I can pass a coefficient as a non-type template parameter.

is a template array possible?

template <auto ...C>
decltype((C, ...)) const a[]{C...};

perhaps even something like:

template <std::size_t I, auto ...C>
auto get() noexcept
{
  // ... easy to implement, but I'm not sure if it is worthwhile
}


问:
I make a button base on a state, but how to make them listen to different event in React?
I'm currently working on a small project
I rendered a button base on a state like these two images,
edit button
save change button

here is my code: but everytime when I click on the edit button it will automatically run the submit button too and the isEdit state can never change to true, like this, problem, please let me know how to solve it. thanks!

```<code>  const [isEdit, setIsEdit] = useState(true)

  return(
    ...
    {isEdit ? (
          <button
            className="btn btn--fill-primary"
            type="submit"
            disabled={isLoading}
            onSubmit={() => {
              console.log("submit")
              setIsEdit(false)
            }}
          >
            save change
          </button>
        ) : (
          <button
            className="btn btn--fill-black"
            type="button"
            disabled={isLoading}
            onClick={() => {
              console.log("click")
              setIsEdit(true)
            }}
          >
        edit
      </button>
    )}
  )
</code>```

at first I render the button like this:

```<code><button
  className={`btn btn--fill-${isEdit ? "primary" : "black"}`}
  type={isEdit ? "submit" : "button"}
  disabled={isLoading}
  onClick={(e) => {
    if (isEdit) {
        console.log('submit')
        setIsEdit(false)
    }

    if (!isEdit) {
        console.log('click')
        setIsEdit(true)
    }
>
    {isEdit ? "save change" : "edit"}
</button>
</code>```

Body:
I'm currently working on a small project
I rendered a button base on a state like these two images,
edit button
save change button

here is my code: but everytime when I click on the edit button it will automatically run the submit button too and the isEdit state can never change to true, like this, problem, please let me know how to solve it. thanks!

  const [isEdit, setIsEdit] = useState(true)

  return(
    ...
    {isEdit ? (
          <button
            className="btn btn--fill-primary"
            type="submit"
            disabled={isLoading}
            onSubmit={() => {
              console.log("submit")
              setIsEdit(false)
            }}
          >
            save change
          </button>
        ) : (
          <button
            className="btn btn--fill-black"
            type="button"
            disabled={isLoading}
            onClick={() => {
              console.log("click")
              setIsEdit(true)
            }}
          >
        edit
      </button>
    )}
  )

at first I render the button like this:

<button
  className={`btn btn--fill-${isEdit ? "primary" : "black"}`}
  type={isEdit ? "submit" : "button"}
  disabled={isLoading}
  onClick={(e) => {
    if (isEdit) {
        console.log('submit')
        setIsEdit(false)
    }

    if (!isEdit) {
        console.log('click')
        setIsEdit(true)
    }
>
    {isEdit ? "save change" : "edit"}
</button>


问:
unserialize(): Error at offset 16383 of 16384 bytes
I Want to run my application in localhost with php artisan serve but I get this Error unserialize(): Error at offset 16383 of 16384 bytes where is my problem? Please help me anyone? Thanks.</p>