Giter Club home page Giter Club logo

vvkeep / jsonconverter Goto Github PK

View Code? Open in Web Editor NEW
944.0 944.0 148.0 40.44 MB

🔥 🔥 🔥 Powerful and beautiful JSON-to-model MacOS app, supports multiple development languages and popular third-party libraries, flexible custom configuration options to meet a variety of individual needs

Home Page: https://github.com/vvkeep/JSONConverter

License: BSD 3-Clause "New" or "Revised" License

Swift 99.57% C 0.08% Ruby 0.35%
flutter golang handyjson ios json json-obectmapper json-objects jsonconverter jsonexport mac model objectmapper supprot-models swift swiftyjson

jsonconverter's Introduction

Hi there 👋

jsonconverter's People

Contributors

akashark avatar lvjunhang avatar mlch911 avatar stack-info avatar vitasapple avatar vvkeep 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

jsonconverter's Issues

发现一个bug

在iOS-oc使用时,如果数据源有空list的情况下,例:
"expand" : {

      },

这样的,会直接崩溃,查看代码这边简单修改为

mutating func removeLastChar() {
if !self.isEmpty {
let range = self.index(endIndex, offsetBy: -1)..<self.endIndex
self.removeSubrange(range)
}
}
增加了一个字符串为空的判断。

如何打赏?

这工具省下我许多时间,我来自**
非常乐意赞助您持续维护!

最新版本闪退

首先很遗憾没有收到您加入微信好友的邀请,日前我已经打赏了
还是希望可以跟您交流交流,有些代码的部份想跟您聊聊
我的微信:League2EB
我的QQ:3410925895


系统:macOS Mojave
版本:10.14.6Beta版 (18G29g)
状况:若把整份程式码打包下来使用自己的证书签署,不会闪退
但若是使用您的Release版本直接拖曳到应用程式内,打开应用会直接闪退

转换出现崩溃

转换的 JSON 值如下:
{
"message" : {
"navigateLastPage" : 1,
"isLastPage" : true,
"pageSize" : 20,
"lastPage" : 1,
"navigatepageNums" : [
1
],
"navigateFirstPage" : 1,
"navigatePages" : 8,
"nextPage" : 0,
"size" : 2,
"pageNum" : 1,
"list" : [
{
"status" : null,
"pullUrl" : "111111",
"groupMasterId" : "",
"updateTime" : null,
"totalPoint" : null,
"createTime" : null,
"virtualMemberCount" : null,
"id" : 1,
"name" : "",
"pushUrl" : "111111",
"appId" : "",
"virtualPoint" : null,
"totalTime" : null,
"type" : "",
"memberCount" : null,
"sortPercent" : null,
"sort" : null
},
{
"status" : null,
"pullUrl" : "111111",
"groupMasterId" : "",
"updateTime" : null,
"totalPoint" : null,
"createTime" : null,
"virtualMemberCount" : null,
"id" : 2,
"name" : "",
"pushUrl" : "111111",
"appId" : "",
"virtualPoint" : null,
"totalTime" : null,
"type" : "",
"memberCount" : null,
"sortPercent" : null,
"sort" : null
}
],
"firstPage" : 1,
"pages" : 1,
"startRow" : 1,
"hasPreviousPage" : false,
"endRow" : 2,
"prePage" : 0,
"isFirstPage" : true,
"total" : 2,
"hasNextPage" : false
},
"status" : "100000"
}

安装完后无法打开,图标换换吧

OS 10.15.6

System Integrity Protection: disabled

Crashed Thread: 0

Exception Type: EXC_CRASH (Code Signature Invalid)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY

Termination Reason: Namespace CODESIGNING, Code 0x1

终端命令使用了
简介中没有那个警告覆盖选项
下载代码运行可以的

代码高亮

我看到代码高亮部分你是自定义的关键字、颜色等
可以考虑Highlightr这个库进行代码高亮

Sent from PPHub

希望能添加一个Codable默认值的转模型

`import Foundation

class DefaultCodableBuilder: BuilderProtocol {
func isMatchLang(_ lang: LangType) -> Bool {
return lang == .DefualtCodable
}

func propertyText(_ type: PropertyType, keyName: String, strategy: PropertyStrategy, maxKeyNameLength: Int, typeName: String?) -> String {
    assert(!((type == .Dictionary || type == .ArrayDictionary) && typeName == nil), " Dictionary type the typeName can not be nil")
    let tempKeyName = strategy.processed(keyName)
    var str = ""
    switch type {
    case .String, .Null:
        str = "\t<String> var \(tempKeyName): String\n"
    case .Int:
        str = "\t<Int> var \(tempKeyName): Int\n"
    case .Float:
        str = "\t<Float> var \(tempKeyName): Float\n"
    case .Double:
        str = "\t<Double> var \(tempKeyName): Double\n"
    case .Bool:
        str = "\t<Bool> var \(tempKeyName): Bool\n"
    case .Dictionary:
        str = "\t<\(typeName!)> var \(tempKeyName): \(typeName!)\n"
    case .ArrayString, .ArrayNull:
        str = "\t<Array> var \(tempKeyName): [String]\n"
    case .ArrayInt:
        str = "\t<Array> var \(tempKeyName): [Int]\n"
    case .ArrayFloat:
        str = "\t<Array> var \(tempKeyName): [Float]\n"
    case .ArrayDouble:
        str = "\t<Array> var \(tempKeyName): [Double]\n"
    case .ArrayBool:
        str = "\t<Array> var \(tempKeyName): [Bool]\n"
    case .ArrayDictionary:
        str = "\t<Array> var \(tempKeyName): [\(typeName!)]\n"
    }

    str.insert(contentsOf: "@Default", at: str.index(str.startIndex, offsetBy: 1))
    str.insert(contentsOf: " = .defaultValue", at: str.index(str.endIndex, offsetBy: -1))

    return str
}

func contentParentClassText(_ clsText: String?) -> String {
   return StringUtils.isEmpty(clsText) ? ": Codable" : ": \(clsText!)"
}

func contentText(_ structType: StructType, clsName: String, parentClsName: String, propertiesText: inout String, propertiesInitText: inout String?, propertiesGetterSetterText: inout String?) -> String {
    if structType == .class {
        return "\nclass \(clsName)\(parentClsName), DefaultValue {\n\(propertiesText)\n\tstatic let defaultValue = \(clsName)()\n\trequired init() {}\n}\n"
    } else {
        propertiesText.removeLastChar()
        return "\nstruct \(clsName)\(parentClsName), DefaultValue {\n\(propertiesText)\n\tstatic let defaultValue = \(clsName)(\(propertiesInitText!.substring(from: 2)))\n}\n"
    }
}

func fileExtension() -> String {
    return "swift"
}

func fileImportText(_ rootName: String, contents: [Content], strategy: PropertyStrategy, prefix: String?) -> String {
    return"\nimport Foundation\n"
}

}`
Codable设置默认值

支持KaKaJSON

麻烦您有空支持一下KaKaJSON嘛,当然我也可以自己动手新增,谢谢

内容有表情会异常卡死

比如:
{
"id": "1005033383",
"nickname": "编码器🤢",
"is_teacher": 0
}

异常定位:
class JSONHightTextStorage: NSTextStorage {

var _string = NSMutableAttributedString()
    
override var string: String {
    return _string.string
}

override func attributes(at location: Int, effectiveRange range: NSRangePointer?) -> [NSAttributedString.Key : Any] {
    return _string .attributes(at: location, effectiveRange: range) // 这里报错
}

截屏2020-09-15 18 07 25

项目运行不了

Xcode 9.2运行一直弹出访问钥匙串弹窗 输入密码也一直弹出

意外退出 mac系统10.14.6

Process: JSONConverter [15088]
Path: /private/var/folders/*/JSONConverter.app/Contents/MacOS/JSONConverter
Identifier: com.devyao.JSONConverter
版本 :v1.2.3-release
安装包

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.