Learn Courses My Dashboard

JSON file error

As I mentioned in my last response to " Using local JSON file for City Sights App", the project has moved onto another problem. Copying the json file from Proxyman into Jsonlint.com shows no errors, however the debug window reads: dataCorrupted(Swift.DecodingError.Context(codingPath: , debugDescription: “The given data was not valid JSON.”, underlyingError: Optional(Error Domain=NSCocoaErrorDomain Code=3840 “Unable to convert data to string around character 4173.” UserInfo={NSDebugDescription=Unable to convert data to string around character 4173.})))

The following file fragment of the json file ends at Character 4,204 ( Including spaces, according to MS Word), so it should include the problem area.

 "display_phone": "(415) 474-5698",
  "distance": 1003.3249146983063
},
{
  "id": "_EncdQezAzcShATMFXL0dA",
  "alias": "tropisueño-san-francisco-10",
  "name": "Tropisueño",
  "image_url": "https://s3-media2.fl.yelpcdn.com/bphoto/hUZgDmue1VRfvIXai6I0wg/o.jpg",
  "is_closed": false,

What should I be doing to correct this problem? I do not see anything obvious.
Thanks

Try to delete the quotes and type them again, sometimes when copying/pasting the quotes get messed up

Trying to figure out which quotes you are talking about. There are no quotes at the start and end of the file. Should I be searching for smart quotes which I know are not allowed? Retyping each quote would be very laborious and I think prone to error.
Thanks

I don’t think it’s a wack quote; those usually display a different error. Can you post a link to your raw code on github or something so we can take a look at it without the forum software mucking things up?

I was able to move this project along to another problem. Replacing the original JSON file with one of my new data allows the project to build but I get this error:

SwiftUI:0: Fatal error: each layout item may only occur once

2021-07-17 23:13:55.368034-0400 City Sights App[62860:27335323] SwiftUI:0: Fatal error: each layout item may only occur once

(lldb)

Two questions:

  1. What does "… each layout item may only occur once** " mean, I do not see an indication of which file/instruction triggered the error.
  2. What is the significance of " (lldb) " , it does not seem to be an eleven decibel tone
    Thanks

Dunno what the layout error is all about without seeing some code.

(lldb) is the debugger console prompt. You can type various commands to get info and do things.

This sounds a bit like you have a situation where the items in the JSON array do not have a unique id. Do you have an id property?

You were correct, adding a unique id did move the project along. Thanks