Code Monkey home page Code Monkey logo

Comments (11)

loganwright avatar loganwright commented on May 4, 2024

FWIW, NSJSONSerialization ran on heroku for me, I also use a library https://github.com/gfx/Swift-PureJsonSerializer which might be nice to use if you'd prefer to stay truly pure Swift

from vapor.

tanner0101 avatar tanner0101 commented on May 4, 2024

Yeah the current JSON serializer for Linux is a placeholder for something better. I was hoping to hold out for Apple supporting pure Dictionary and Array objects in their Foundation serializer (possibly that is now true in the latest versions of the compiler).

I will look into that repo you linked.

from vapor.

tanner0101 avatar tanner0101 commented on May 4, 2024

I took a look into a couple JSON serializers for supposedly "Swift on Linux" last night, and none of them worked. The current Linux compiler does not view [String: Any] as an AnyObject which they all seem to rely on. Or some rely on defining your JSON like this:

let response: JSON = [
     ....
]

I'm not a fan of this solution because this destroys the concise syntax of something like:

Route.get("...") { _ in
  return [
      ...
  ]
}

You can use the Foundation JSON serializer if you explicitly make all of your responses NSDictionarys with NSString keys, but that is a pain semantically.

I can't see any solution now besides waiting for the compiler to get its weirdnesses figured out.

from vapor.

loganwright avatar loganwright commented on May 4, 2024

I see the problem with the requiring an explicit type addition.

I've solved a similar problem w/ Json convertible types on top of pure json serializer. I'll see if I can apply some of that here so the user could see just a standard concise syntax and we'd be able to convert it in the background.

from vapor.

tanner0101 avatar tanner0101 commented on May 4, 2024

If you could make a PR or link me to some examples of this working that would be helpful. Also, nice article on Medium. 👍

from vapor.

loganwright avatar loganwright commented on May 4, 2024

@tannernelson Will do, might not be until tomorrow, but I have some code that should work for this. I just need to break the convertible component out so we're not doing copy pasta between the two libs.

Glad you saw the medium post, I couldn't find your twitter to link you, let me know if you have one and I'll add it!

from vapor.

tanner0101 avatar tanner0101 commented on May 4, 2024

My twitter is @tanner0101

And that sounds good. Feel free to submit the PR early/incomplete if you want assistance working on it.

from vapor.

loganwright avatar loganwright commented on May 4, 2024

@tannernelson If you didn't see, we're up on http://iosdevweekly.com/

Hopefully can get some more traffic this way! I've started some of the Json convertible stuff, I'll have a pr up soon hopefully 👍

from vapor.

tanner0101 avatar tanner0101 commented on May 4, 2024

Awesome! :) Congrats.

Also, check out issue #28. There is a potential solution for serializing and parsing mentioned there.

from vapor.

mpclarkson avatar mpclarkson commented on May 4, 2024

Awesome coverage!

Matthew Clarkson

On 20 Feb 2016, at 6:52 AM, Tanner [email protected] wrote:

Awesome! :) Congrats.

Also, check out issue #28. �There is a potential solution for serializing and parsing mentioned there.


Reply to this email directly or view it on GitHub.

from vapor.

tanner0101 avatar tanner0101 commented on May 4, 2024

Added to roadmap.

from vapor.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.