Skip to content

复制json文本到剪贴板,然后就可以“粘贴成property”

Notifications You must be signed in to change notification settings

chaoshenglu/json2property

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 

Repository files navigation

json2property

- (id)runWithInput:(id)input fromAction:(AMAction *)anAction error:(NSDictionary **)errorInfo {
    //获取鼠标选中的字符串
    NSArray *arr = (NSArray *)input;
    NSString *string = [NSString stringWithFormat:@"%@",arr.firstObject];
    
    //字符串转字典
    NSDictionary *dic = [NSDictionary dictionaryWithString:string];
    
    //字典中遍历出相关字段,生成property
    [NSString findPropertyWithDic:dic];
    
    //合并生成最终需要的字符串
    NSString *result = [NSString allProperty];
    
    //拷贝到剪贴板
    [[NSPasteboard generalPasteboard] declareTypes:[NSArray arrayWithObject:NSStringPboardType] owner:nil];
    [[NSPasteboard generalPasteboard] setString:result forType:NSStringPboardType];
    
    return result;
}

About

复制json文本到剪贴板,然后就可以“粘贴成property”

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published