Code Monkey home page Code Monkey logo

j2s's People

Contributors

nsillik avatar zadr avatar zeveisenberg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

j2s's Issues

go back to json?

it might be useful to emit a dictionary view of a struct, so we can convert back to a JSON object if needed (say, for POSTing changes).

This might be a task better left for external codegen (say, from Sourcery), but it's closely related to the work that j2s already does, so it might get a slide anyway (in the same way that j2s emits Hashable and Equatable implementations already anyway).

This may also be a better fit in j2s than another tool because we'll still have the context for what format data came in from (e.g.: was a Date an epoch time? Rails' Time.now? ISO 8601? etc)

No responding issue

app will freeze if input json like this

 {
 "pages": [
            {
                "cid": 19965680,
                "page": 1,
                "from": "vupload",
                "part": "NEW GAME!! 01",
                "duration": 1421,
                "vid": "",
                "weblink": "",
                "metas": [
                    {
                        "quality": 16,
                        "format": "",
                        "size": 97693
                    }
                ]
            } 
        ]
}

Identify BCP 47 identifiers and turn them into Locale objects

BCP 47 defines Tags for Identifying Languages.

Given the following JSON:

{
    "language": "en",
    "foo": true
}

j2s will currently output the following Swift code:

public struct Root {
	let foo: Bool
	let language: String

	init?(_ dictionary: [String: Any]) {
		if let foo = dictionary["foo"] as? Bool {
			self.foo = foo
		} else {
			return nil
		}
		
		if let language = dictionary["language"] as? String {
			self.language = language
		} else {
			return nil
		}
	}
}

but it might be useful if could identify BCP 47 identifiers and instead output code using Locales, such as:

public struct Root {
	let foo: Bool
	let language: String

	init?(_ dictionary: [String: Any]) {
		if let foo = dictionary["foo"] as? Bool {
			self.foo = foo
		} else {
			return nil
		}
		
		if let language = dictionary["language"] as? String {
			Locale(localeIdentifier: language)
		} else {
			return nil
		}
	}
}

Identify more date formats

j2s currently only identifies date strings in the format of eee MMM dd HH:mm:ss Z yyyy (or: Sat Dec 31 04:27:14 +0000 2016) which is given by Rails and Time.now , but it would be nice to recognize more common date formats (iso8601, rfc822, epoch, etc)

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.