{"id":17772240,"url":"https://github.com/monkeydom/objectivetoml","last_synced_at":"2025-09-02T20:50:53.330Z","repository":{"id":137803029,"uuid":"153905363","full_name":"monkeydom/ObjectiveTOML","owner":"monkeydom","description":"ObjectiveTOML is a simple Objective-C Library to read and write TOML files.","archived":false,"fork":false,"pushed_at":"2023-02-12T13:17:56.000Z","size":58,"stargazers_count":16,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-10-26T22:27:36.339Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Objective-C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/monkeydom.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-10-20T12:53:30.000Z","updated_at":"2024-03-13T23:24:14.000Z","dependencies_parsed_at":"2023-05-22T14:30:34.144Z","dependency_job_id":null,"html_url":"https://github.com/monkeydom/ObjectiveTOML","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/monkeydom%2FObjectiveTOML","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/monkeydom%2FObjectiveTOML/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/monkeydom%2FObjectiveTOML/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/monkeydom%2FObjectiveTOML/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/monkeydom","download_url":"https://codeload.github.com/monkeydom/ObjectiveTOML/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223881649,"owners_count":17219268,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-26T21:38:34.279Z","updated_at":"2024-11-09T21:02:22.285Z","avatar_url":"https://github.com/monkeydom.png","language":"Objective-C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ObjectiveTOML\n\nObjectiveTOML is a clean and nice Objective-C API to read and write [TOML](https://github.com/toml-lang/toml) files. It is utilizing [toml11](https://github.com/ToruNiina/toml11) and therefore on par with its TOML compliance. At time of writing this is [TOML 1.0.0](https://toml.io/en/v1.0.0)\n\nThe main target is a small command line utility `tomlutil` to convert between TOML, JSON and the xml and binary plist format on macOS.\n\nThe API is aligned with `NSJSONSerialization`:\n\n```objectivec\n#import \"LMPTOMLSerialization.h\"\n\nNSData *inputData = [NSData dataWithContentsOfURL:fileURL];\nNSDictionary \u003cNSString *, id\u003e* tomlObject = \n  [LMPTOMLSerialization TOMLObjectWithData:inputData error:\u0026error];\n// now tomlObject holds the contents of the TOML file. \n\n```\n\nThe `tomlutil` has nice parsing error reporting (if you only want this, you can use the `-lint` option:\n\n```\n$\u003e ./tomlutil -lint toml-examples/wrong.toml \n🚫 Input TOML could not be parsed\n[error] toml::parse_key_value_pair: invalid format for key\n --\u003e toml-examples/wrong.toml\n    |\n 14 | asdfpoin1!@ j= ;alskjfasdf\n    |          ^--- invalid character in key\n    |\nHint: Did you forget '.' to separate dotted-key?\nHint: Allowed characters for bare key are [0-9a-zA-Z_-]. \n```\n\nCurrent usage output:\n\n```\ntomlutil v2.0.0 (toml11 v3.7.1)\n\nUsage: tomlutil [-f json|xml1|binary1|toml] file [outputfile]\n\nA file of '-' reads from stdin. Can read json, plists and toml. Output defaults to stdout.\n-f format   Output format. One of json, xml1, binary1, toml. Defaults to toml.\n-lint       Just lint with toml11, no output.\n```\n\nSimple conversion of the Mojave News.app plist to TOML:\n\n```toml\n$\u003e ./tomlutil /System/Applications/News.app/Contents/Info.plist \nSBAppUsesLocalNotifications = true\nDTSDKBuild = \"22D40\"\nUILaunchStoryboardName = \"LaunchScreen\"\nCFBundleHelpBookName = \"com.apple.News.help\"\nNSSupportsSuddenTermination = true\nDTPlatformVersion = \"13.2\"\nUIViewGroupOpacity = false\nCFBundleDisplayName = \"News\"\nCFBundleName = \"News\"\nHPDHelpProjectIdentifier = \"news\"\nUIDeviceFamily = [6]\nCFBundlePackageType = \"APPL\"\nUIRequiredDeviceCapabilities = [\"armv7\"]\nCFBundleSignature = \"????\"\nUIMenuBarItemTitleQuit = \"Quit News\"\nCFBundleVersion = \"3270.0.1\"\nLSSupportedRegions = [\"US\",\"GB\",\"AU\",\"CA\"]\nNSLocationDefaultAccuracyReduced = true\nUIMenuBarItemTitleHelp = \"News Help\"\nNSLocationUsageDescription = \"\"\"\nGet top local news and weather, and locally relevant search results an\\\nd ads.\\\n\"\"\"\nUIMenuBarItemTitleAbout = \"About News\"\nUIMenuBarItemTitleHide = \"Hide News\"\nNSCalendarsUsageDescription = \"This will let you add events from News to your calendar.\"\nCFBundleSupportedPlatforms = [\"MacOSX\"]\nNSLocationWhenInUseUsageDescription = \"\"\"\nGet top local news and weather, and locally relevant search r\\\nesults and ads.\\\n\"\"\"\nCFBundleInfoDictionaryVersion = \"6.0\"\nLSMinimumSystemVersion = \"13.2\"\nCFBundleIdentifier = \"com.apple.news\"\nNSHumanReadableCopyright = \"Copyright © 2022 Apple Inc. All rights reserved.\"\nNSPhotoLibraryAddUsageDescription = \"\"\nUIWhitePointAdaptivityStyle = \"UIWhitePointAdaptivityStyleReading\"\nNSContactsUsageDescription = \"\"\nNSSupportsAutomaticTermination = true\nCFBundleShortVersionString = \"8.2.1\"\nCFBundleIconFile = \"AppIcon\"\nCTIgnoreUserFonts = true\nUIAppFonts = []\nUIUserInterfaceStyle = \"Automatic\"\nDTXcodeBuild = \"14A6270d\"\nCFBundleExecutable = \"News\"\nDTCompiler = \"com.apple.compilers.llvm.clang.1_0\"\nCFBundleIconName = \"AppIcon\"\nUIStatusBarHidden = false\n\"UISupportedInterfaceOrientations~ipad\" = [\n\"UIInterfaceOrientationPortrait\",\n\"UIInterfaceOrientationPortraitUpsideDown\",\n\"UIInterfaceOrientationLandscapeLeft\",\n\"UIInterfaceOrientationLandscapeRight\",\n]\nBuildMachineOSBuild = \"20A241133\"\nUIViewControllerBasedStatusBarAppearance = true\nUIBackgroundModes = [\"audio\",\"fetch\",\"remote-notification\"]\nNSAccentColorName = \"NewsAccentColor\"\nUIViewEdgeAntialiasing = false\nDTPlatformName = \"macosx\"\nSBMatchingApplicationGenres = [\n\"News\",\"Reference\",\"Entertainment\",\"Productivity\",\"Education\",\n\"Business\",\n]\nNSUserActivityTypes = [\n\"TagIntent\",\"TodayIntent\",\"com.apple.news.articleViewing\",\n\"com.apple.news.feedBrowsing\",\"com.apple.news.feedBackCatalog\",\n\"com.apple.news.forYou\",\"com.apple.news.history\",\"com.apple.news.saved\",\n\"com.apple.news.magazineSections\",\"com.apple.news.link\",\n]\nUIApplicationShortcutWidget = \"com.apple.news.widget\"\nCFBundleDevelopmentRegion = \"en\"\nUISupportedInterfaceOrientations = [\"UIInterfaceOrientationPortrait\"]\nCFBundleHelpBookFolder = \"News.help\"\nBGTaskSchedulerPermittedIdentifiers = [\"com.apple.news.backgroundFetchManager\"]\n_LSSupportsRemoval = true\nDTSDKName = \"macosx13.2.internal\"\nDTPlatformBuild = \"22D40\"\nNSPhotoLibraryUsageDescription = \"\"\nDTXcode = \"1400\"\nLSCounterpartIdentifiers = [\"com.apple.nanonews\"]\n\n[[UIApplicationShortcutItems]]\nUIApplicationShortcutItemTitle = \"ApplicationShortcutItemForYou\"\nUIApplicationShortcutItemIconFile = \"ios_for_you_icon_large\"\nUIApplicationShortcutItemType = \"com.apple.news.openforyou\"\n\n[UNUserNotificationCenter]\nUNSuppressUserAuthorizationPrompt = false\n\n[UIApplicationSceneManifest]\nUIApplicationSupportsMultipleScenes = \"1\"\n\n[UIApplicationSceneManifest.UISceneConfigurations]\n\n[[UIApplicationSceneManifest.UISceneConfigurations.UIWindowSceneSessionRoleApplication]]\nUISceneConfigurationName = \"Default Configuration\"\nUISceneDelegateClassName = \"NewsUI2.SceneDelegate\"\nUISceneClassName = \"TeaUI.WindowScene\"\n\n\n[[CFBundleURLTypes]]\nCFBundleURLSchemes = [\"applenews\",\"applenewss\"]\nCFBundleURLName = \"com.apple.NewsCustomScheme\"\nCFBundleTypeRole = \"Editor\"\n```\n\nFull header:\n\n```objectivec\n@interface LMPTOMLSerialization : NSObject\n\n/**\n Generate a Foundation Dictionary from TOML data.\n\n @param data NSData representing a TOML file\n @param error helpful information if the parsing fails\n @return NSDictionary representing the contents of the TOML file. Note that given dates will be represented as NSDateComponents, use +serializationObjectWtihTOMLObject: to convert those to RFC3339 strings that can be used in JSON or PropertyList serializations.\n */\n+ (NSDictionary \u003cNSString *, id\u003e*)TOMLObjectWithData:(NSData *)data error:(NSError **)error;\n\n/**\n Generates NSData representation of the TOMLObject. The representation is UTF8 and can be stored directly as a TOML file.\n \n Note that roundtripping is a lossy opreation, as all comments are stripped, the allowed number formats are reduced to canonical ones and doubles might lose or gain unwanted precision.\n \n @param tomlObject Foundation Object consisting of TOML serializable objects. In addition to plist objects this contains NSDateComponent objects with y-m-d filled, h-m-s-[nanoseconds] filled, all fields filled, or all fields + timezone filled.\n @param error helpful information if generation fails\n @return NSData representing the object.\n */\n+ (NSData *)dataWithTOMLObject:(NSDictionary\u003cNSString *, id\u003e *)tomlObject error:(NSError **)error;\n\n/**\n Takes a Dictionary representing a TOML file and translates the NSDateComponents into RFC339 strings to be able to be serialized in JSON or PropertyLists\n\n @param tomlObject foundation dictionary consisting of TOML serializable objects.\n @return NSDictionary containing property list serializable objects.\n */\n+ (NSDictionary\u003cNSString *, id\u003e *)serializableObjectWithTOMLObject:(NSDictionary\u003cNSString *, id\u003e *)tomlObject;\n\n@end\n```\n\n## Changelog\n\n* v2.0.0\n   * switched to [toml11] (https://github.com/ToruNiina/toml11\n\n* v1.1.0\n   * Updated to cpptoml v0.1.1\n   * Added more arguments, help and error reporting to the `tomlutil`\n\n* v1.0.1\n   * Fixed an issue with cpptoml with trailing whitespace and comments in dates as well as allowing for empty inline tables now.\n\n* v1.0\n   * Reading and writing works. Dates are handeled. Conversion between json, plists and toml works as expected.\n\n* v0.1.0\n\t* Basic reading works, no support of Date format yet, or of the switches promised.  \t\n\n## Authors\n\n* **Dominik Wagner** - [monkeydom](https://github.com/monkeydom) - [@monkeydom@mastodon.social](https://mastodon.social/@monkeydom)\n\n## License\n\nDistributed under the MIT License - see [LICENSE.txt](LICENSE.txt) file for details\n\n## Acknowledgments\n\n* ObjectiveTOML relies on the excellent [cpptoml](https://github.com/skystrife/cpptoml)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmonkeydom%2Fobjectivetoml","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmonkeydom%2Fobjectivetoml","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmonkeydom%2Fobjectivetoml/lists"}